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

@xsolla/xui-input

v0.209.1

Published

A cross-platform text input with label, error, icon, clear and validation support; works on web and React Native via `XUIProvider` themed contexts. <!-- BEGIN:xui-mcp-instructions:input --> An interactive field that lets users enter, edit, or review infor

Readme

Input

A cross-platform text input with label, error, icon, clear and validation support; works on web and React Native via XUIProvider themed contexts.

An interactive field that lets users enter, edit, or review information. Inputs communicate what kind of data is expected and help users provide the information needed to complete tasks, make updates, or refine content across the product.

When to use

  • When you need to collect a short, freeform text value from a user (name, email, search query, etc.)
  • When the expected input fits on a single line
  • As part of a larger form alongside other controls

When not to use

  • When the expected input spans multiple lines — use a TextArea instead
  • When the user must pick from a predefined list — use a Select, MultiSelect or Autocomplete instead
  • When the value is numeric with constraints — use a InputPhone or InputRange instead
  • When the value is card number — use a InputPayment instead
  • When the value is time or date — use a InputTime or DatePicker instead
  • When the value is pin code — use a InputPin instead

Content guidelines

  • Do not use the placeholder as a substitute for a label.
  • Placeholder text should describe the expected format or example value (e.g. "Enter your email", "DD/MM/YYYY"), not repeat the label.
  • Error messages should be constructive: explain what is wrong and how to correct it (e.g. "Email is required", not just "Invalid input").
  • Remove button should appear only when the field has a value, giving users a quick way to clear it.
  • Check icon should appear after successful validation to confirm the value is accepted.

Behavior guidelines

  • Input width — fields should reflect the expected content length; avoid overly wide fields for short values like ZIP code, OTP, or CVV unless the layout requires it.
  • Validation timing — do not show errors before a user has interacted with the field. Validate on blur, on submit, or progressively while typing only when it meaningfully helps.
  • Error state — preserve the user’s entered value, show error text close to the field, and do not rely on color alone to communicate the problem.

Accessibility

  • Error messages must be linked to the input via aria-describedby so screen readers announce them on focus.
  • Never rely on placeholder text alone to communicate the field's purpose — it disappears on input and has low contrast by default.
  • Disabled fields should not receive keyboard focus; consider using a read-only state if the value still needs to be accessible.

Installation

npm install @xsolla/xui-input

Imports

import { Input } from '@xsolla/xui-input';
import type { InputProps } from '@xsolla/xui-input';

Quick start

const [value, setValue] = useState('');

<Input
  label="Email"
  value={value}
  onChangeText={setValue}
  placeholder="[email protected]"
/>;

API Reference

<Input>

| Prop | Type | Default | Description | | --- | --- | --- | --- | | value | string | — | Controlled value. | | placeholder | string | — | Placeholder shown when empty. | | onChange | (e: ChangeEvent<HTMLInputElement>) => void | — | Native change handler. | | onChangeText | (text: string) => void | — | Simplified change handler receiving the text. | | size | 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' | 'md' | Control size. | | disabled | boolean | false | Disable the input. | | label | string | — | Label rendered above the input. | | error | boolean | false | Apply error styling. | | errorMessage | string | — | Error message; also marks the input invalid. | | iconLeft | ReactNode | — | Icon on the left. | | iconRight | ReactNode | — | Icon on the right. | | iconRightSize | number \| string | — | Override the right-icon size. | | extraClear | boolean | false | Show a clear button when the input has a value. | | onRemove | () => void | — | Fired when the clear button is pressed. | | checked | boolean | false | Show a success indicator (suppressed when errorMessage is set). | | checkedIcon | ReactNode | <CheckCr /> | Override the checked icon. | | borderTopLeftRadius | number | — | Override top-left corner radius. | | borderTopRightRadius | number | — | Override top-right corner radius. | | borderBottomLeftRadius | number | — | Override bottom-left corner radius. | | borderBottomRightRadius | number | — | Override bottom-right corner radius. | | backgroundColor | string | — | Override the background colour. | | id | string | auto | HTML id; also wires up the label. | | aria-label | string | — | Accessible label when no visible label is present. | | testID | string | — | Test identifier. |

Input also accepts the standard InputHTMLAttributes (excluding size and onChange, which are redefined above).

Inherits ThemeOverrideProps (themeMode, themeProductContext).

Examples

Sizes

<Input size="xs" placeholder="Extra small" />
<Input size="sm" placeholder="Small" />
<Input size="md" placeholder="Medium" />
<Input size="lg" placeholder="Large" />
<Input size="xl" placeholder="Extra large" />

Icons

import { Search, Check } from '@xsolla/xui-icons';
import { Mail } from '@xsolla/xui-icons-base';

<Input iconLeft={<Search />} placeholder="Search..." />
<Input iconLeft={<Mail />} iconRight={<Check />} placeholder="Email" />

Clear button

const [value, setValue] = useState('Some text');

<Input
  value={value}
  onChangeText={setValue}
  extraClear
  onRemove={() => setValue('')}
  placeholder="Type something..."
/>;

Validation

const [email, setEmail] = useState('');
const error = email && !email.includes('@') ? 'Invalid email' : '';

<Input
  label="Email"
  value={email}
  onChangeText={setEmail}
  error={!!error}
  errorMessage={error}
  placeholder="[email protected]"
/>;

Disabled and success

<Input label="Disabled" value="Cannot edit" disabled />
<Input label="Username" value="johndoe" checked />

Custom border radius

<Input
  placeholder="Rounded"
  borderTopLeftRadius={20}
  borderTopRightRadius={20}
  borderBottomLeftRadius={20}
  borderBottomRightRadius={20}
/>

Accessibility

  • Renders a semantic <input> whose aria-labelledby points at the id of the rendered <label> element (rather than the standard <label htmlFor> pairing).
  • Error messages are linked through aria-describedby and announced via role="alert".
  • aria-invalid and aria-disabled reflect error and disabled state.
  • Pressing Escape blurs the input.