Primitives
Input
Labelled single-line text entry with hint and error states
import { Input } from '@amezquita/design-system/components/primitives/Input'Live render
We’ll only use it for release notes.
Props
| Prop | Type | Description |
|---|---|---|
type? | 'text' | 'email' | 'password' | 'url' | 'search' | 'tel' | |
label? | string | |
value? | string | |
defaultValue? | string | |
onChange? | (value: string) => void | |
onClear? | () => void | |
error? | string | |
hint? | string | |
prefix? | React.ReactNode | |
suffix? | React.ReactNode | |
clearable? | boolean | |
search? | boolean | |
searchLabel? | string |
Also accepts all props of: Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'defaultValue' | 'prefix' | 'type' | 'children'>
Usage example
<Input
id="default"
label="Email address"
placeholder="you@example.com"
type="email"
/>Accessibility
<label>is auto-linked viauseId()— never use placeholder as the only label- When no
labelprop:aria-labelmust be passed instead aria-invalid="true"set automatically whenerrorprop is presentaria-describedbylinks the input to the hint/error element by id- Focus: outline uses
--input-border-focus(maps to--color-border-focus); error state uses--input-border-errorinstead 'use client'— usesuseId(), cannot render as a server component