• 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

ColorRadio

A single controlled color-swatch radio: a circular chip filled with a hex color that shows a check icon when selected. Renders a <div role="radio">. The color label is rendered visually hidden (sr-only) for accessibility.

When to use

Use ColorRadio as the primitive for one selectable color swatch when you manage its checked state yourself.

For a full labelled set of swatches bound to a single value, use ColorRadioGroup (or @uxf/form/color-radio-group inside a @uxf/form form). ColorRadio is the primitive that group composes.

Usage

import { ColorRadio } from "@uxf/ui/color-radio";

<ColorRadio checked={value === 1} color="#ff0000" colorLabel="Red" name="color" onChange={setValue} value={1} />;

Omit onChange to render a non-interactive swatch.

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 swatch is selected.
color `#${string}` — (required) Swatch background (hex). The check-icon color (black/white) is derived from its luminance.
colorLabel ReactNode — (required) Accessible label; rendered visually hidden.
value ValueType — (required) Value passed to onChange when activated.
name string — (required) Field name.
onChange (value: ValueType) => void — Called with value on click.
renderContent (className, checked, colorLabel, value) => ReactNode — Custom inner render; replaces the default check Icon.
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, dims the swatch).
isInvalid boolean false 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.

Unlike Radio, ColorRadio has no size prop.

Variants & states

No theme variants or sizes. States are driven by props: checked shows the check icon; isDisabled dims the swatch with an overlay.

Requirements

Import the stylesheets once in your global CSS (the swatch renders the check icon, so icon.css is required):

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

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

Default
Open in new tab