Label
Associate visible text with a form control.
Overview
Label is a styled native label for a control you wire yourself when no Field description, error, or shared state is needed.
Use when
A single form control needs a visible programmatic label.
Use instead
Use Field when the control also needs help text, validation feedback, or required state.
Usage
import { Label, Stack, TextInput } from "@smoothie-framework/whisk-react";
<Stack gap={2}>
<Label htmlFor="project-slug">Project slug</Label>
<TextInput id="project-slug" placeholder="atlas" />
</Stack>Examples
With a checkbox
Use a control's label prop when it owns the label and any description. Use Label when a separate layout needs the control first; clicking this Label still toggles the Checkbox.
import { Checkbox, Label, StackRow } from "@smoothie-framework/whisk-react";
<StackRow align="center" gap={2}>
<Checkbox id="release-notes" />
<Label htmlFor="release-notes">Send me release notes</Label>
</StackRow>Disabled
Label does not reflect a disabled control. Use Field with disabled when the label and a supported Whisk/UI control need to share disabled state.
import { Field, Label, Stack, TextInput } from "@smoothie-framework/whisk-react";
<Stack gap={4}>
<Stack gap={2}>
<Label htmlFor="archived-slug">Archived project slug</Label>
<TextInput id="archived-slug" defaultValue="atlas" disabled />
</Stack>
<Field disabled label="Workspace name">
<TextInput defaultValue="Atlas" />
</Field>
</Stack>Sizes and weights
Use size and weight to match the surrounding form hierarchy without changing the label's native association.
import { Label, Stack, TextInput } from "@smoothie-framework/whisk-react";
<Stack gap={3}>
<Stack gap={1}>
<Label htmlFor="small-label" size="xs" weight="normal">Small label</Label>
<TextInput id="small-label" size="sm" />
</Stack>
<Stack gap={1}>
<Label htmlFor="default-label">Default label</Label>
<TextInput id="default-label" />
</Stack>
<Stack gap={1}>
<Label htmlFor="strong-label" size="lg" weight="semibold">Strong label</Label>
<TextInput id="strong-label" size="lg" />
</Stack>
</Stack>No visible label
When the design cannot show a visible label, use aria-label. A placeholder describes expected input; it does not name the control.
import { TextInput } from "@smoothie-framework/whisk-react";
<TextInput
type="search"
aria-label="Search documentation"
placeholder="Search documentation"
/>Props
Component props
Shared props
Accessibility
Every editable control needs a programmatic name. Use Label with htmlFor for a simple native association; in Octane the attribute is also named htmlFor. Do not use Label inside Field: Field renders its own label. Use Field when a control also needs a description, validation message, or shared state propagation.
Content guidance
Use a short noun phrase such as Project name. Do not use a placeholder as the label or add a trailing colon.