Actions & Basics
@hacline/ui/labelLabel
Names a control and forwards clicks to its associated input or control.
Usage
Click "Device name" to focus the input. Inside a Field with helper text or validation messages, use FieldLabel to establish complete associations.
"use client";
import { useId } from "react";
import { Input } from "@/components/ui/hacline/components/input";
import { Label } from "@/components/ui/hacline/components/label";
export const Example = () => {
const id = useId();
return (
<div className="grid w-full max-w-xs gap-2">
<Label htmlFor={id}>Device name</Label>
<Input id={id} placeholder="e.g. Studio Display" />
</div>
);
};Associating with a Switch
Associate the label with a switch ID using htmlFor. Clicking the label text also toggles the switch.
"use client";
import { useId } from "react";
import { Label } from "@/components/ui/hacline/components/label";
import { Switch } from "@/components/ui/hacline/components/switch";
export const Example = () => {
const id = useId();
return (
<div className="flex items-center gap-2">
<Switch id={id} />
<Label className="cursor-pointer" htmlFor={id}>
Enable ticket notifications
</Label>
</div>
);
};Props
Prop
Type