npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dbp-toolkit/form-elements

v0.2.17

Published

Form elements for the Digital Blueprint Toolkit

Readme

Form Element Web Components

GitHub | NPM

This package offers form components to be used to create an HTML form.

You can install this component via npm:

npm i @dbp-toolkit/form-elements

Usage

<dbp-form-string-element></dbp-form-string-element>
<script type="module" src="node_modules/@dbp-toolkit/form-elements/dist/string.js"></script>

Or directly via CDN:

<dbp-form-string-element></dbp-form-string-element>
<script
    type="module"
    src="https://unpkg.com/@dbp-toolkit/[email protected]/dist/string.js"></script>

Attributes

Best look at demo.js for the example implementation.

General Attributes

  • lang (optional, default: de): Language setting
    • Type: String
    • Accepts: de (German) or en (English)
    • Example: <element lang="en"></element>
  • name: Element name
    • Type: String
    • Used for identifying the form element
  • description: Descriptive text for the element
    • Type: String
    • Provides additional context or explanation
  • label: Display label for the element
    • Type: String
    • Text shown alongside or near the form element
  • value: Current value of the element
    • Type: String
    • Reflects current input state
  • required: Indicates if the element is mandatory
    • Type: Boolean
    • Determines if the field must be filled
  • hidden: Indicates if the element is hidden
    • Type: Boolean
    • Hides the element if set to true
  • disabled: Indicates if the element is disabled
    • Type: Boolean
    • Disables the element if set to true
  • customValidator: Custom validation function
    • Type: Function
    • Example: <element .customValidator=${(value, evaluationData) => {return value === 'test' ? ['My message'] : []}}></element>

String Element

  • rows (optional, default: 1): Number of rows for the text area (1 means a single-line input)
    • Type: Number
    • Example: <dbp-form-string-element rows="3"></dbp-form-string-element>
  • placeholder (optional): Placeholder text for the input field
    • Type: Text
    • Example: <dbp-form-string-element placeholder="Short phrase that hints at the expected data"></dbp-form-string-element>

Boolean Element

  • value: Use the string true or false to set the value
    • Type: String
    • Example: <dbp-form-boolean-element value="true"></dbp-form-boolean-element>
  • state: Instead of value you can also use state to set the state of the boolean element as a boolean
    • Type: Boolean
  • data-value: Returns the state of the boolean element
    • Type: Boolean

Examples

The change event is fired when the state changes. The event contains the new state in e.detail.state as a boolean.

Boolean Element with String Value
<dbp-form-boolean-element
    subscribe="lang"
    name="myBoolean"
    label="My label"
    description="My description"
    .value=${this.myBoolean ? 'true' : 'false'}
    @change="${(e) { console.log('state', e.detail.state); }}>
</dbp-form-boolean-element>
Boolean Element with Boolean State
<dbp-form-boolean-element
    subscribe="lang"
    name="myBoolean"
    label="My label"
    description="My description"
    .state=${this.myBoolean}
    @change="${(e) { console.log('state', e.detail.state); }}>
</dbp-form-boolean-element>

Date Element

  • min: Indicates the minimum value that can be entered
    • Type: String/Date
  • max: Indicates the maximum value that can be entered
    • Type: String/Date

Enum Element

<dbp-form-enum-element
    ${ref(this.myComponentEnumRef)}
    subscribe="lang"
    name="myComponentEnum"
    label="My enum"
    .value=${data.myComponentEnum || ''}
    .items=${{item1: 'Item 1', item2: 'Item 2'}}
    multiple
    required>
    <span slot="label">
        Label with HTML content. Can be used interchangeably the label property.
    </span>
</dbp-form-enum-element>

Please always use .value to set the value of the enum element, as it is a property and not an attribute.

  • items: List of items to select from
    • Type: Object
    • Example: <dbp-form-enum-element .items=${{item1: 'Item 1', item2: 'Item 2'}}></dbp-form-enum-element>
  • multiple (optional, default: false): Indicates if multiple items can be selected
    • Type: Boolean
    • Example: <dbp-form-enum-element multiple></dbp-form-enum-element>
  • display-mode (optional, default: dropdown): Render as checkbox or radiobutton in list mode, select-element in dropdown mode or as tags in tags mode
    • Type: String
    • Example with list: <dbp-form-enum-element display-mode="list"></dbp-form-enum-element>
    • Example with tags: <dbp-form-enum-element display-mode="tags"></dbp-form-enum-element>

Form Views

They are a little similar to the form element components. Best look at demo.js for the example implementation.

General Attributes

  • lang (optional, default: de): Language setting
    • Type: String
    • Accepts: de (German) or en (English)
    • Example: <view lang="en"></view>
  • label: Display label for the view
    • Type: String
    • Text shown alongside or near the form view
  • value: Current value of the view
    • Type: String
    • Reflects current input state
  • hidden: Indicates if the view is hidden
    • Type: Boolean
    • Hides the view if set to true

Local development

# get the source
git clone [email protected]:digital-blueprint/toolkit.git
cd toolkit/packages/form-elements

# install dependencies
npm install

# constantly build dist/bundle.js and run a local web-server on port 8002
npm run watch

# run tests
npm test

# build local packages in dist directory
npm run build

Jump to http://localhost:8002 and you should get a demo page.