Zip Code Input
Input restricted to 5 numeric digits for US zip codes.
Installation
tsx
import { ZipCodeInput } from "@workspace/ui/components/zip-code-input"Basic usage
tsx
const [zip, setZip] = useState("")
<ZipCodeInput
label="Zip code"
placeholder="12345"
value={zip}
onChange={setZip}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | - | Label above the input. |
| error | string | - | Error message shown below. |
| hint | string | - | Hint text below. |
| value | string | - | 5-digit zip code. |
| onChange | (value: string) => void | - | Called when value changes (max 5 digits). |
| containerClassName | string | - | Classes for the wrapper. |
| inputClassName | string | - | Classes for the input element. |