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

@outbook/webcomponents-form-input-text

v1.1.1

Published

Web components form-input-text

Readme

@outbook/webcomponents-form-input-text

This package provides a customizable text input form web component, supporting various input types, validation, and internationalization.

Installation

npm install @outbook/webcomponents-form-input-text

Usage

As a Lit Element

import { html, useState } from 'lit';
import { FormInputText } from '@outbook/webcomponents-form-input-text';

function MyForm() {
  const [email, setEmail] = useState('');
  const [password, setPassword] = useState('');

  const handleValidation = (event) => {
    console.log(`Input validity for ${event.target.inputName}:`, event.detail.isValid);
  };

  const handleKeyup = (event) => {
    if (event.target.inputName === 'email') {
      setEmail(event.target.value);
    } else if (event.target.inputName === 'password') {
      setPassword(event.target.value);
    }
  };

  return html`
    <form>
      ${FormInputText({
        type: 'email',
        inputName: 'email',
        label: 'Email Address',
        required: true,
        inputValue: email,
        onKeyup: handleKeyup,
        validateFn: handleValidation,
      })}
      ${FormInputText({
        type: 'password',
        inputName: 'password',
        label: 'Password',
        required: true,
        inputValue: password,
        onKeyup: handleKeyup,
        validateFn: handleValidation,
      })}
    </form>
  `;
}

Direct HTML Usage

You can also use the custom element directly in your HTML. Remember to import the component's JavaScript for the custom element to be defined.

import '@outbook/webcomponents-form-input-text';
<outbook-form-input-text
  type="text"
  input-name="username"
  label="Username"
  input-value="initial_value"
  required="required"
  lang="en"
></outbook-form-input-text>

<script>
  document.querySelector('outbook-form-input-text').addEventListener('validated', (e) => {
    console.log('Input validated:', e.detail.isValid);
  });
  document.querySelector('outbook-form-input-text').addEventListener('input-keyup', (e) => {
    console.log('Input keyup:', e.detail.originalEvent);
  });

  // To access methods like reset() or getValue()
  const myInput = document.querySelector('outbook-form-input-text');
  console.log(myInput.getValue());
  // myInput.reset();
</script>

Component: outbook-form-input-text

This is the underlying web component. It can be used directly in HTML or in any framework.

Properties

| Attribute | Property | Type | Default | Description | |-----------------|-----------------|-----------|----------------|---------------------------------------------------------------------------------| | type | type | String | 'text' | The input type (e.g., text, email, password). | | input-name | inputName | String | '' | The name attribute for the internal <input> element. | | label | label | String | '' | The text for the input's label. | | labelledby | labelledby | String | undefined | aria-labelledby attribute for accessibility. | | placeholder | placeholder | String | undefined | The placeholder text for the input. | | input-id | inputId | String | null | The id for the internal <input>. A unique ID is generated if not provided. | | icon | icon | String | null | The name of an icon to display inside the input. | | .icons | icons | Object | {} | An object containing icon definitions. | | input-value | inputValue | String | '' | The initial value of the input. | | required | required | String | 'optional' | Set to 'required' to make the field mandatory. | | disabled | disabled | String | false | Set to 'disabled' to disable the input. | | validate-message | validateMessage | String | '' | A custom error message to display on validation failure. | | lang | lang | String | 'en' | Sets the language for localization (e.g., "en", "es"). | | test-id | testId | String | null | A test identifier for testing purposes (data-test-id). |

Methods

  • reset(): Resets the input value and validation state.
  • getValue(): Returns the current value of the input.

Events

  • validated: Dispatched whenever the input's validity changes. event.detail.isValid (boolean) indicates the current validity.
  • input-keyup: Dispatched on every keyup event inside the input. event.detail.originalEvent contains the original keyup event.

Styling

This component does not use Shadow DOM, so its internal elements can be styled directly using global stylesheets.

You need to include the component's SCSS file in your project's main stylesheet.

@use '@outbook/webcomponents-form-input-text/form-input-text' as form-input-text;

@include form-input-text.style();

License

This component is licensed under the Apache-2.0 License.