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

@polarityio/pi-input

v1.0.6

Published

Text input component with multiple types, validation, clearable field, and error states

Readme

Polarity Integration Component Library

Input Component

A text input component supporting multiple input types with validation, clearable functionality, password visibility toggle, and comprehensive error state management.

Installation

npm install @polarityio/pi-input

Peer Dependencies

Usage

import '@polarityio/pi-input';
<!-- Basic text input -->
<pi-input label="Username" placeholder="Enter your username"></pi-input>

<!-- Password input with toggle visibility -->
<pi-input type="password" label="Password" placeholder="Enter password"></pi-input>

<!-- Clearable input -->
<pi-input clearable placeholder="Search..." value="some text"></pi-input>

<!-- Number input with constraints -->
<pi-input type="number" label="Quantity" min="0" max="100" step="1"></pi-input>

<!-- Input with error message -->
<pi-input label="Email" type="email" error error-message="Please enter a valid email"></pi-input>

<!-- With prefix and suffix slots -->
<pi-input placeholder="Amount">
  <span slot="prefix">$</span>
  <span slot="suffix">.00</span>
</pi-input>

Handling Events

const input = document.querySelector('pi-input');

input.addEventListener('pi-input', (e) => {
  console.log('Current value:', e.detail.value);
});

input.addEventListener('pi-change', (e) => {
  console.log('Committed value:', e.detail.value);
});

input.addEventListener('pi-clear', () => {
  console.log('Input cleared');
});

API Reference

Properties

| Property | Type | Default | Description | | -------------- | --------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------- | | type | 'text' \| 'number' \| 'password' \| 'email' \| 'search' \| 'tel' \| 'url' | 'text' | Input type | | value | string | '' | Current input value | | placeholder | string | '' | Placeholder text displayed when input is empty | | label | string | '' | Label text displayed above the input | | name | string | '' | HTML name attribute for form submission | | disabled | boolean | false | Disables the input and hides action buttons | | readonly | boolean | false | Makes the input read-only | | clearable | boolean | false | Shows a clear button when the input has a value | | error | boolean | false | Sets error state styling on the input | | errorMessage | string | '' | Error message displayed below the input. Setting this also activates the error state. | | min | string \| undefined | undefined | Minimum value (for number inputs) | | max | string \| undefined | undefined | Maximum value (for number inputs) | | step | string \| undefined | undefined | Step value for number inputs | | maxlength | number \| undefined | undefined | Maximum character length | | minlength | number \| undefined | undefined | Minimum character length | | pattern | string \| undefined | undefined | Regex pattern for validation | | autocomplete | string | 'off' | HTML autocomplete attribute |

Events

| Event Name | Detail | Description | | ----------- | ------------------- | ------------------------------------------------------ | | pi-input | { value: string } | Fired on each keystroke in the input field | | pi-change | { value: string } | Fired when the value changes and the input loses focus | | pi-clear | (none) | Fired when the clear button is clicked |

Slots

| Slot Name | Description | | --------- | -------------------------------------------------------------------------- | | prefix | Content displayed to the left of the input (e.g., icons, currency symbols) | | suffix | Content displayed to the right of the input (e.g., units, icons) |

CSS Custom Properties

| Property | Default | Description | | -------------------------- | ----------------------------------------------- | -------------------------------- | | --pi-input-line-height | 1.75em | Height of the input wrapper | | --pi-input-padding | 4px 8px | Padding inside the input wrapper | | --pi-input-border | 1px solid var(--pi-input-border-color) | Border definition | | --pi-input-border-color | var(--pi-color-border-element) | Border color | | --pi-input-border-radius | var(--pi-size-radius-base, 4px) | Border radius | | --pi-input-background | var(--pi-color-background-container-base) | Background color | | --pi-input-text-color | var(--pi-color-font-primary) | Text color | | --pi-input-disabled-bg | var(--pi-color-background-container-disabled) | Background when disabled |

CSS Parts

| Part Name | Description | | ----------------- | ----------------------------------------------------------------------------- | | wrapper | The main flex container holding the input and action buttons | | input | The native HTML <input> element | | clear-button | The clear (×) button shown when clearable is true and the input has a value | | password-toggle | The password visibility toggle button (eye icon) for password inputs | | error-message | The error message container below the input |

Public Methods

| Method | Description | | ------------------------------- | ------------------------------------------------- | | focus(options?: FocusOptions) | Programmatically focuses the native input element | | select() | Selects all text in the input field |

Theming

Customize the appearance using CSS custom properties. This component uses design tokens from @polarityio/pi-shared for consistent theming across the component library.

pi-input {
  --pi-input-border-radius: 8px;
  --pi-input-padding: 8px 12px;
}

pi-input::part(input) {
  font-size: 1rem;
}

License

MIT