import * as React from 'react'; import { cn } from '@/lib/utils'; export interface RadioProps extends Omit, 'type' | 'size'> { invalid?: boolean; } /** * A real radio button (a native input: with the same name the arrow keys move and select inside the group, Space selects), * drawn in the colours of the theme: a clear round border, the accent colour with a dot when selected, hover, a focus * ring, disabled and error states, and system colours in forced-colors (high contrast) mode. */ export const Radio = React.forwardRef(({ className, invalid = false, ...props }, ref) => ( )); Radio.displayName = 'Radio'; interface RadioFieldProps extends RadioProps { label: React.ReactNode; } /** A radio button with its label: the whole line is clickable and at least 24 px high. */ export const RadioField = React.forwardRef(({ label, id, disabled, ...props }, ref) => { const generated = React.useId(); const inputId = id ?? generated; return ( ); }); RadioField.displayName = 'RadioField'; /** The group around related radio buttons: role radiogroup with a name, so a screen reader announces what is chosen. */ export function RadioGroup({ label, className, children, ...props }: { label: string } & Omit, 'aria-label'>) { return (
{children}
); }