Skip to content

Label

Form

Accessible label element that pairs with form inputs.

Text field labelCheckbox label
Open preview

Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.

Usage

Link labels to controls with matching htmlFor and id values. Explain required fields in visible text as well as with the native required attribute.

Import
import { Label } from "@dashboardpack/core/components/ui/label";

Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.

API reference

Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.

Label props
PropType / DefaultDescription
htmlForstring

Default: —

The id of the labeled control.
childrenReactNode

Default: —

Visible field name.
classNamestring

Default: —

Extend label styling.

Build with these too