Label, Input and Textarea
Native form controls in the design system’s style. They render real <label>, <input>, <select> and <textarea> elements, so a form works from a Server Component, without JavaScript, and with the browser’s built-in validation. For labelled fields with descriptions and validation messages wired up for you, use Field.
import { Input, Label, Textarea } from '@blocks/design-system'A native form
Associate each label with its control: give the control an id and the Label the same htmlFor. Every control keeps its name, defaultValue, required and disabled attributes, so the browser submits and validates the form as usual.
Source · inputs/report-form.tsx
import { Button, Input, Label, Stack, Textarea } from '@blocks/design-system'
// A Server Component: a native form with no client JavaScript.
export default function ReportForm() {
return (
<Stack as="form" action="/components/inputs" method="get" gap="none" aria-label="Snow report">
<Input.Wrap>
<Label htmlFor="report-station">Station</Label>
<Input id="report-station" name="station" defaultValue="Mount Hood" required />
</Input.Wrap>
<Input.Wrap>
{/* Input.Label is presentational; as="label" with htmlFor makes it a real label. */}
<Input.Label as="label" htmlFor="report-surface">
Surface
</Input.Label>
<Input.Select id="report-surface" name="surface" defaultValue="powder">
<option value="powder">Powder</option>
<option value="crust">Wind crust</option>
<option value="ice">Ice</option>
</Input.Select>
</Input.Wrap>
<Input.Wrap>
<Label htmlFor="report-notes">Notes</Label>
<Textarea id="report-notes" name="notes" rows={3} />
</Input.Wrap>
<Input.Wrap>
<Label htmlFor="report-observer">Observer</Label>
<Input id="report-observer" name="observer" disabled defaultValue="Automated station" />
</Input.Wrap>
<div>
<Button type="submit" variant="primary">
Send report
</Button>
</div>
</Stack>
)
}Nothing submitted yet.
Source · inputs/submitted-report.tsx
'use client'
import { Body, Code } from '@blocks/design-system'
import { useEffect, useState } from 'react'
// Reads what the form above submitted, from the URL it navigated to.
export default function SubmittedReport() {
const [entries, setEntries] = useState<[string, string][]>([])
useEffect(() => setEntries([...new URLSearchParams(window.location.search)]), [])
if (entries.length === 0) return <Body color="text-muted">Nothing submitted yet.</Body>
return (
<dl aria-label="Submitted report">
{entries.map(([name, value]) => (
<div key={name}>
<dt>
<Code>{name}</Code>
</dt>
<dd style={{ whiteSpace: 'pre-wrap' }}>{value}</dd>
</div>
))}
</dl>
)
}Parts
| Part | Renders | Use |
|---|---|---|
Label | <label> | The label for a control, with htmlFor. |
Input | <input> | Text-like inputs: text, email, number, search. |
Input.Select (InputSelect) | <select> | A native select in the Input style. |
Textarea | <textarea> | Multi-line text. |
Input.Wrap (InputWrap) | <div> | Spacing below a label and control. |
Input.Label (InputLabel) | <span> | Presentational label text. It labels nothing unless you pass as="label" and htmlFor. |
The dot names and the named exports are the same components; Input isn’t a client module, so both work in Server Components.
States and sizes
variant="error" draws the danger border and sets aria-invalid. Point aria-describedby at the message that explains the error. size follows the control-height tokens: sm, md (the default) and lg.
Enter a number, such as 5370.
Source · inputs/states.tsx
import { BodySmall, Input, Label, Stack } from '@blocks/design-system'
export default function States() {
return (
<Stack gap="md">
<Stack gap="xxs">
<Label htmlFor="state-error">Elevation (ft)</Label>
<Input id="state-error" variant="error" defaultValue="tall" aria-describedby="state-error-message" />
<BodySmall id="state-error-message" color="danger-text" margin="none">
Enter a number, such as 5370.
</BodySmall>
</Stack>
<Stack gap="xxs">
<Label htmlFor="state-small">Small</Label>
<Input id="state-small" size="sm" placeholder="sm" />
</Stack>
<Stack gap="xxs">
<Label htmlFor="state-large">Large</Label>
<Input id="state-large" size="lg" placeholder="lg" />
</Stack>
</Stack>
)
}Other native controls
useControlClassName returns Input’s class names for a native element the package doesn’t wrap, such as a date input.
Source · inputs/control-class-name.tsx
import { Label, Stack, useControlClassName } from '@blocks/design-system'
// useControlClassName returns the class names Input uses, for a native
// element the package doesn't wrap. It calls no React hooks, so it also works
// in Server Components.
export default function ControlClassName() {
const className = useControlClassName({ size: 'md' })
return (
<Stack gap="xxs">
<Label htmlFor="report-date">Observed on</Label>
<input id="report-date" type="date" defaultValue="2026-12-01" className={className} />
</Stack>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
color | "text" | "overlay" | "bg" | "bg-subtle" | "surface" | "surface-hover" | "surface-active" | "selected" | "border-subtle" | "border" | "border-strong" | "focus-ring" | "accent" | "accent-hover" | "accent-fg" | "accent-subtle" | "accent-text" | "danger" | "danger-hover" | "danger-fg" | "danger-subtle" | "danger-text" | "warning" | "warning-hover" | "warning-fg" | "warning-subtle" | "warning-text" | "success" | "success-hover" | "success-fg" | "success-subtle" | "success-text" | "info" | "info-hover" | "info-fg" | "info-subtle" | "info-text" | "text-muted" | — | A color token. Defaults to `"text"`. |
fontFamily | "body" | "heading" | "monospace" | — | A font token: `body`, `heading` or `monospace`. |
fontSize | "body" | "code" | "heading" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl" | "xxxxl" | "xxxxxl" | "inherit" | sm | A font size token, e.g. `"sm"` or `"heading"`, or `"inherit"` to keep the parent's size. Defaults to `"body"`. |
fontWeight | "body" | "heading" | "medium" | "bold" | "semibold" | semibold | A font weight token: `body`, `medium`, `semibold`, `heading` or `bold`. |
lineHeight | "body" | "heading" | "inherit" | — | `body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`. |
Also accepts styling escape hatches, margin props and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "lg" | — | Height from the `--ds-control-height-*` tokens. |
variant | "default" | "error" | — | `"error"` shows the danger border and sets `aria-invalid`. Defaults to `"default"`. |
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "lg" | — | Height from the `--ds-control-height-*` tokens. |
variant | "default" | "error" | — | `"error"` shows the danger border and sets `aria-invalid`. Defaults to `"default"`. |
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | — | The element or component to render, e.g. `as={NextLink}`. |
Also accepts Box layout props, styling escape hatches, margin props, padding props and a ref, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
as | ElementType | — | The element or component to render, e.g. `as={NextLink}`. |
color | "text" | "overlay" | "bg" | "bg-subtle" | "surface" | "surface-hover" | "surface-active" | "selected" | "border-subtle" | "border" | "border-strong" | "focus-ring" | "accent" | "accent-hover" | "accent-fg" | "accent-subtle" | "accent-text" | "danger" | "danger-hover" | "danger-fg" | "danger-subtle" | "danger-text" | "warning" | "warning-hover" | "warning-fg" | "warning-subtle" | "warning-text" | "success" | "success-hover" | "success-fg" | "success-subtle" | "success-text" | "info" | "info-hover" | "info-fg" | "info-subtle" | "info-text" | "text-muted" | — | A color token. Defaults to `"text"`. |
fontFamily | "body" | "heading" | "monospace" | — | A font token: `body`, `heading` or `monospace`. |
fontSize | "body" | "code" | "heading" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl" | "xxxxl" | "xxxxxl" | "inherit" | — | A font size token, e.g. `"sm"` or `"heading"`, or `"inherit"` to keep the parent's size. Defaults to `"body"`. |
fontWeight | "body" | "heading" | "medium" | "bold" | "semibold" | — | A font weight token: `body`, `medium`, `semibold`, `heading` or `bold`. |
lineHeight | "body" | "heading" | "inherit" | — | `body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`. |
Also accepts styling escape hatches and margin props, and the native attributes of the element it renders.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "default" | "error" | default | `"error"` shows the danger border and sets `aria-invalid`. Defaults to `"default"`. |
Also accepts styling escape hatches and a ref, and the native attributes of the element it renders.
Accessibility
- Every control needs a label. A placeholder is not a label: it disappears as soon as someone types.
- Mark errors with
variant="error"and a visible message linked byaria-describedby; don’t rely on the red border alone. disabledcontrols are skipped by Tab and left out of the submission. UsereadOnlyfor values people should be able to read and submit.