• CMSnpm version

    • Overview
    • ContentBuilder
    • InviteUserForm
    • LoginForm
    • RenewPasswordForm
    • WysiwygInput
  • 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
    • Switch
    • ✅ 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
  • DnDnpm 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

ColorRadioGroup

A labelled group of color swatches bound to a single hex value. Built on Base UI's RadioGroup and Radio.Root; renders a label, the swatches (each an inner ColorRadio), and optional helper/error text.

When to use

Use @uxf/ui/color-radio-group for a controlled color-swatch group outside a form, where you own value and onChange.

Use @uxf/form/color-radio-group inside a @uxf/form form — that twin wires react-hook-form (useController), consumes the form context (disabled/read-only, required validation), and derives its value from the field.

Usage

import { ColorRadioGroup } from "@uxf/ui/color-radio-group";
import { HexColor } from "@uxf/ui/types";
import { useState } from "react";

const options = [
    { value: "#ff0000", label: "Red" },
    { value: "#00ff00", label: "Green" },
    { value: "#0000ff", label: "Blue" },
] satisfies { value: HexColor; label: string }[];

function Example() {
    const [value, setValue] = useState<HexColor | null>("#ff0000");

    return (
        <ColorRadioGroup
            id="colors"
            label="Pick a color"
            name="color"
            onChange={setValue}
            options={options}
            value={value}
        />
    );
}

Props

Extends FormControlProps<HexColor | null> (from @uxf/ui/types). HexColor is `#${string}`.

PropTypeDefaultDescription
labelReactNode— (required)Group label.
namestring— (required)Field name.
optionsColorRadioGroupOption[]— (required)Swatches to render.
valueHexColor | null— (required)Hex value of the selected swatch.
onChange(value: HexColor | null) => void— (required)Called with the selected hex value.
helperTextReactNode—Text shown below the swatches; styled as an error when isInvalid.
hiddenLabelbooleanfalseVisually hide the label (kept for accessibility).
idstring—Root id; also used to build the error-message id.
classNamestring—Extra class on the root element.
styleCSSProperties—Inline style on the root element.
isDisabledbooleanfalseDisables the group and all swatches.
isInvalidbooleanfalseError styling on the group and helper text.
isRequiredbooleanfalseMarks the label as required.

The inherited isFocused, isReadOnly, onFocus, and onBlur are part of the shared FormControlProps shape but are not wired by this UI component; they are consumed by the @uxf/form twin. Unlike RadioGroup, ColorRadioGroup has no variant or radioSize props.

ColorRadioGroupOption — one entry of options:

FieldTypeDescription
value`#${string}`Hex color; both the option value and the swatch color.
labelReactNodeAccessible label for the swatch.
disabledbooleanDisable this single swatch.

Variants & states

No theme variants or sizes. States are driven by props: the selected swatch shows a check icon, isDisabled dims the swatches, and isInvalid applies error styling to the helper text.

Requirements

Import the stylesheets once in your global CSS (the group renders ColorRadio, which uses the check icon):

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

form-component.css provides the helper/error text styling (.uxf-helper-text); import it if you use helperText or validation:

@import url("@uxf/ui/css/form-component.css");

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

Default
Open in new tab
States
Open in new tab