Base Radio Checkbox
BaseRadioCheckbox is a low-level component that provides the foundational building blocks for creating Radio and Checkbox components. It includes reusable parts for control styling, labels, and help text.Installation
Component Parts
BaseRadioCheckbox consists of four sub-components:BaseRadioCheckboxControl
The visual control box that displays the checked/unchecked state.BaseRadioCheckboxLabel
The label wrapper that connects the label text to the input.BaseRadioCheckboxLabelText
The text content within the label.BaseRadioCheckboxHelpText
Help text displayed below the control.Props
BaseRadioCheckboxControl
The icon or content to display inside the control box (e.g., check mark icon).
Whether the control is disabled.
Only used in Visual Picker to apply hover styles.
Overrides the default element name for customization.
BaseRadioCheckboxLabel
The label content.
The ID of the associated input element.
BaseRadioCheckboxLabelText
The text content of the label.
Overrides the default element name for customization.
BaseRadioCheckboxHelpText
The help text content.
Unique identifier for the help text element, used for aria-describedby.
Overrides the default element name for customization.
States
The BaseRadioCheckboxControl supports multiple interactive states:- Default: Normal, unchecked state
- Hover: Mouse hover state
- Focus: Keyboard focus state
- Active: Mouse down state
- Checked: Selected state
- Disabled: Non-interactive state
- Invalid: Error state
- Checked + Hover: Checked with mouse hover
- Checked + Focus: Checked with keyboard focus
- Checked + Disabled: Checked but disabled
- Invalid + Disabled: Invalid but disabled
Best Practices
Do
- Use this component as a building block for custom radio or checkbox-like controls
- Maintain consistent spacing and sizing with the base implementation
- Follow the established pattern for state management
- Connect labels properly using htmlFor and input IDs
Don’t
- Don’t use this for standard checkboxes or radios - use the Checkbox or Radio components
- Don’t modify core interaction states without good reason
- Don’t create controls that don’t follow radio/checkbox semantics
- Don’t skip accessibility attributes when building on top of this component
Accessibility
- Always associate labels with inputs using htmlFor
- Use helpTextId to connect help text via aria-describedby
- Ensure all interactive states have appropriate visual indicators
- Maintain sufficient color contrast in all states
- Support keyboard navigation (focus states)
Related Components
- Checkbox - Standard checkbox input
- Radio - Radio button input
- Checkbox Group - Group of checkboxes
- Radio Group - Group of radio buttons