Simple field
A label, a hint or an error, and the control, with the message linked to it.
Enter a full email address
Installation
pnpm add @heyramzi/uiUsage
import { SimpleField } from "@heyramzi/ui/shadcn/field";<SimpleField label="Email" for="email" description="We reply within a day." {error}>
<input id="email" bind:value={email} />
</SimpleField>Keyboard and accessibility
- label is tied to the control through for, which has to match the control's id.
- The description or error is linked to the control with aria-describedby, so it's read after the label.
- An error also marks the control invalid and is read out as soon as it appears.
API reference
labelstringdescriptionstringerrorstringforstring- Id of the control the label binds to. Also picks the control that gets the message link.
labelVariant"default" | "muted"- Default
"default" - "default" is text-sm foreground; "muted" is a text-xs micro-label.
classstringchildrenrequiredSnippet
| Prop | Type | Default |
|---|---|---|
label | string | |
description | string | |
error | string | |
for Id of the control the label binds to. Also picks the control that gets the message link. | string | |
labelVariant "default" is text-sm foreground; "muted" is a text-xs micro-label. | "default" | "muted" | "default" |
class | string | |
children required | Snippet |