#031
States
Four NumberField states in a Stack: with description, with error and required, disabled, and small.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "States" pattern (@codeatlasdev/ui demo #031, inputs/number-field) in my app.
Call get_demo({ ids: ["#031"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Documenting helper text, validation, locked and compact variants of numeric fields such as seat counts.
Keep these library parts, with the props and tokens the demo uses:
- NumberField, Stack from "@codeatlasdev/ui"
Behaviour to keep:
- `<NumberField label="Seats" value={3} min={1} max={50} description="Max 50 seats per plan." />`
- `bind:value={seats}` with `let seats = $state(60)`, `error="Plans support up to 50 seats."` and `required`
- `<NumberField label="Fixed amount" bind:value={fixed} disabled />`
- `<NumberField label="Small" size="sm" value={2} />`
- `<Stack gap="4">` wraps the four fields
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- NumberField
@codeatlasdev/ui - Stack
@codeatlasdev/ui
How it is built
- `<NumberField label="Seats" value={3} min={1} max={50} description="Max 50 seats per plan." />`
- `bind:value={seats}` with `let seats = $state(60)`, `error="Plans support up to 50 seats."` and `required`
- `<NumberField label="Fixed amount" bind:value={fixed} disabled />`
- `<NumberField label="Small" size="sm" value={2} />`
- `<Stack gap="4">` wraps the four fields
Related
Loading source.