Forms & Inputs
@hacline/ui/radioRadio
Select a single option from a named group.
Usage
Click a label or press arrow keys while focused to change digest cadence. The group's name sets the submitted form field name.
"use client";
import { useId } from "react";
import { Label } from "@/components/ui/hacline/components/label";
import {
Radio,
RadioGroup,
RadioIndicator,
} from "@/components/ui/hacline/components/radio";
export const Example = () => {
const id = useId();
const weekly = `${id}-weekly`;
const monthly = `${id}-monthly`;
return (
<RadioGroup
aria-label="Digest frequency"
defaultValue="weekly"
name="digest-rate"
>
<div className="flex items-center gap-2">
<Radio id={weekly} value="weekly">
<RadioIndicator />
</Radio>
<Label htmlFor={weekly}>Weekly digest</Label>
</div>
<div className="flex items-center gap-2">
<Radio id={monthly} value="monthly">
<RadioIndicator />
</Radio>
<Label htmlFor={monthly}>Monthly digest</Label>
</div>
</RadioGroup>
);
};Skipping Disabled Options
Disabled release channels stay visible while arrow-key navigation skips directly across enabled choices.
"use client";
import {
Radio,
RadioGroup,
RadioIndicator,
} from "@/components/ui/hacline/components/radio";
export const Example = () => (
<RadioGroup
aria-label="Release channel"
defaultValue="preview"
name="release-channel"
>
<label className="flex items-center gap-2">
<Radio value="preview">
<RadioIndicator />
</Radio>
Preview
</label>
<label className="text-hl-fg-muted flex items-center gap-2">
<Radio disabled value="production">
<RadioIndicator />
</Radio>
Production (approval required)
</label>
<label className="flex items-center gap-2">
<Radio value="staging">
<RadioIndicator />
</Radio>
Staging
</label>
</RadioGroup>
);Parts
| Part | Description | Extended Props |
|---|---|---|
Radio | A radio and the hidden native radio that takes part in the form. | size |
RadioIndicator | The dot inside the radio. Rendered while it's checked, or always with keepMounted. | — |
Props
Prop
Type