Copy to clipboard
<Label for="email">Your email address</Label>
<Label for="email">Your email address</Label><Label for="email">Your email address</Label>
Installation
Copy to clipboard
npx bearnie add label
npx bearnie add labelnpx bearnie add label
bunx bearnie add label
bunx bearnie add labelbunx bearnie add label
pnpm dlx bearnie add label
pnpm dlx bearnie add labelpnpm dlx bearnie add label
yarn dlx bearnie add label
yarn dlx bearnie add labelyarn dlx bearnie add label
Usage
import { Label } from "@/components/bearnie/label"<Label for="email">Email</Label>Examples
With input
Copy to clipboard
<div class="grid gap-2 w-full max-w-sm">
<Label for="email">Email</Label>
<Input type="email" id="email" placeholder="m@example.com" />
</div>
<div class="grid gap-2 w-full max-w-sm">
<Label for="email">Email</Label>
<Input type="email" id="email" placeholder="m@example.com" />
</div><div class="grid gap-2 w-full max-w-sm">
<Label for="email">Email</Label>
<Input type="email" id="email" placeholder="m@example.com" />
</div>
With checkbox
Copy to clipboard
<div class="flex items-center gap-2">
<Checkbox id="terms" />
<Label for="terms">Accept terms and conditions</Label>
</div>
<div class="flex items-center gap-2">
<Checkbox id="terms" />
<Label for="terms">Accept terms and conditions</Label>
</div><div class="flex items-center gap-2">
<Checkbox id="terms" />
<Label for="terms">Accept terms and conditions</Label>
</div>
Required
Copy to clipboard
<div class="grid gap-2 w-full max-w-sm">
<Label for="name" required>Name</Label>
<Input id="name" placeholder="Enter your name" required />
</div>
<div class="grid gap-2 w-full max-w-sm">
<Label for="name" required>Name</Label>
<Input id="name" placeholder="Enter your name" required />
</div><div class="grid gap-2 w-full max-w-sm">
<Label for="name" required>Name</Label>
<Input id="name" placeholder="Enter your name" required />
</div>
Anatomy
Label- A single label element
Props
Label
| Prop | Type | Default | Description |
|---|---|---|---|
| for | string | - | ID of the associated form element |
| required | boolean | false | Shows required indicator (*) |
| class | string | - | Additional CSS classes |