• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
  • UInpm version

    • Overview
    • Accordion
    • AlertBubble
    • AnnouncementBar
    • Avatar
    • AvatarFileInput
    • Badge
    • Button
    • ButtonGroup
    • ButtonList
    • Calendar
    • Checkbox
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • Chip
    • ColorRadio
    • ColorRadioGroup
    • Combobox
    • DatePicker
    • DatePickerInput
    • DateRangePicker
    • DateRangePickerInput
    • DatetimePicker
    • DatetimePickerInput
    • Dialog
    • Dropdown
    • Dropzone
    • ErrorMessage
    • FileInput
    • FlashMessages
    • FormComponent
    • Icon
    • IconButton
    • ImageGallery
    • InfoBox
    • Input
    • Label
    • Layout
    • Lightbox
    • ListItem
    • Loader
    • Lozenge
    • Menu
    • Message
    • Modal
    • ✅ ModalDialog
    • ✅ ModalHeader
    • MultiCombobox
    • MultiSelect
    • Pagination
    • Paper
    • Popover
    • Radio
    • RadioGroup
    • RasterImage
    • Select
    • ✅ Tabs
    • TextInput
    • TextLink
    • Textarea
    • TimePicker
    • TimePickerInput
    • Toggle
    • Tooltip
    • Typography
  • Formnpm version

    • Overview
    • AvatarFileInput
    • CheckboxButton
    • CheckboxInput
    • CheckboxList
    • ColorRadioGroup
    • Combobox
    • DatePickerInput
    • DateRangePickerInput
    • DatetimePickerInput
    • Dropzone
    • FileInput
    • Form
    • FormRenderer
    • GpsInput
    • MoneyInput
    • MultiCombobox
    • MultiSelect
    • NumberInput
    • PasswordInput
    • RadioGroup
    • Select
    • TextInput
    • Textarea
    • TimePickerInput
    • Toggle
  • DataGridnpm version

    • Overview
    • DataGrid
    • DataGridCustomExample
    • ExportButton
    • FilterList
    • Filters
    • FiltersButton
    • FulltextInput
    • HiddenColumns
    • HiddenColumnsButton
    • Pagination
    • RowCounts
    • RowsPerPageSelect
    • SelectedRowsToolbar
    • TableV2
    • ToolbarControl
    • ToolbarCustoms
    • ToolbarTabs
  • Wysiwygnpm version

    • Overview
  • Resizernpm version

    • Overview
  • Routernpm version

    • Overview
  • Corenpm version

    • Overview
  • Core-Reactnpm version

    • Overview
  • Stylesnpm version

    • Overview
  • Localizenpm version

    • Overview
  • Analyticsnpm version

    • Overview
  • Datepickernpm version

    • Overview
  • Icons-generatornpm version

    • Overview
  • Smart-addressnpm version

    • Overview
  • E2Enpm version

    • Overview
  • E2E-Playwrightnpm version

    • Overview
View source on GitLab

Radio

A single controlled radio indicator. Renders a <span role="radio"> with a dot inside; it does not render its own label.

When to use

Use Radio as a low-level building block when you need one radio control and manage its checked state yourself. It does not enforce mutual exclusion on its own.

For a full labelled set of mutually exclusive options bound to a single value, use RadioGroup (or @uxf/form/radio-group inside a @uxf/form form) — that is the usual entry point. Radio is the primitive RadioGroup composes.

Usage

import { Radio } from "@uxf/ui/radio";

<Radio checked={value === 1} name="plan" onChange={setValue} value={1} />;

Omit onChange to render a non-interactive indicator.

Props

Extends FormControlProps<ValueType> (from @uxf/ui/types) without its onChange. ValueType defaults to string | number.

Prop Type Default Description
checked boolean — (required) Whether this radio is selected.
value ValueType — (required) Value passed to onChange when activated.
name string — (required) Field name.
onChange (value: ValueType) => void — Called with value on click. Omit for a read-only indicator.
size RadioSize "default" Indicator size.
renderContent (className, checked, value) => ReactNode — Custom render of the inner dot; replaces the default <span>.
className string — Extra class on the root element.
style CSSProperties — Inline style on the root element.
isDisabled boolean false Non-interactive state (sets aria-disabled, removes pointer events).
isInvalid boolean false Error styling (sets aria-invalid).
isReadOnly boolean false Removes the control from the tab order (sets aria-readonly).
isRequired boolean false Sets aria-required.
isFocused boolean false Forced focus indicator.
onFocus FocusEventHandler — Focus handler.
onBlur FocusEventHandler — Blur handler.

Variants & states

Sizes (from theme.ts):

Group Values
size default, lg

RadioSizes is an open interface, so a project can add its own values via module augmentation:

declare module "@uxf/ui/radio/theme" {
    interface RadioSizes {
        sm: true;
    }
}

Behavioural states are driven by the props above: checked (selected), isInvalid, isDisabled, isReadOnly.

Requirements

Import the component stylesheet once in your global CSS:

@import url("@uxf/ui/css/radio.css");

Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.

Default
Open in new tab