Components
Label
A form label component with accessibility features.
Installation
bunx --bun harukit@latest add label
npx harukit@latest add label
pnpm dlx harukit@latest add label
yarn harukit@latest add input
Example
"use client";
import { Label } from "@/components/ui/label";
export function LabelDemo() {
return (
<div className="grid w-full items-center gap-1.5">
<Label htmlFor="email">Email</Label>
<Input type="email" id="email" placeholder="Enter your email" />
</div>
);
}
API Reference
Label
The main label component.
import { Label } from "@/components/ui/label";
Props
Prop | Type | Default | Description |
---|---|---|---|
htmlFor | string | - | The ID of the form control that the label is associated with. |
asChild | boolean | false | Change the default rendered element for the one passed as a child, merging their props and behavior. |