Pixie
View as Markdown

Input

Single-line text input with label, hint, and error states.

Props#

NameTypeDefaultDescription
valuestringControlled value.
defaultValuestringUncontrolled initial value.
placeholderstringPlaceholder shown when the input is empty.
labelstringLabel rendered above the input.
hintstringHelpful hint shown below the input.
errorstringError message shown below the input — replaces the hint and applies error styling.
disabledbooleanfalseDisable the input.
type"number" | "text" | "email" | "password" | "tel" | "url"textHTML input type.
onChange((value: string) => void)Change handler — receives the new value.

Default#

Show code
Default.stories.tsx
import { Input } from '../../../src/pixie/Input.js';

export default () => <Input placeholder="Type here..." />;

With label and hint#

Show code
WithLabelAndHint.stories.tsx
import { Input } from '../../../src/pixie/Input.js';

export default () => (
  <Input label="Display name" placeholder="e.g. Tudor" hint="Visible to other users." />
);

Error state#

Show code
ErrorState.stories.tsx
import { Input } from '../../../src/pixie/Input.js';

export default () => (
  <Input label="Email" defaultValue="not-an-email" error="Enter a valid email address." />
);

Disabled#

Show code
Disabled.stories.tsx
import { Input } from '../../../src/pixie/Input.js';

export default () => <Input label="API key" defaultValue="sk-…" disabled />;