A box people tick to opt in, or to pick any number of options from a set.
import { Checkbox } from '@oztix/roadie-components/checkbox'import { CheckboxGroup } from '@oztix/roadie-components/checkbox-group'
A single checkbox for a yes or no choice. Pass label and the whole row
becomes the click target.
<Checkbox label='Send me news about upcoming events' />
<Checkbox label='Add ticket insurance' description='Get a refund if you cannot make it on the night.' />
Use CheckboxGroup when people can pick more than one option. It tracks the
ticked values as an array.
Give the group allValues and add an item with parent. The parent ticks or
clears every child, and shows a dash when only some are ticked. The group must
be controlled.
Wrap a checkbox in Field to get helper and error text.
The checkbox picks up invalid, required and disabled from the Field, and
screen readers hear the helper or error text with it.
A group in a Field takes its label from Field.Label.
<CheckboxGroup direction='horizontal'> <CheckboxGroup.Item value='fri' label='Friday' /> <CheckboxGroup.Item value='sat' label='Saturday' /> <CheckboxGroup.Item value='sun' label='Sunday' /> </CheckboxGroup>
normal turns each item into a card, with the box on the right. Set it on the
group, or on a single Checkbox.
Tab moves between checkboxes. Space ticks or clears the
focused one.role="checkbox" with aria-checked, which reads
mixed when indeterminate. CheckboxGroup renders role="group".label wraps the box in a <label>, so it names the checkbox
and the whole row is clickable. Label a group with CheckboxGroup.Label,
Field.Label, or a Fieldset legend.The id of the input element.
Identifies the field when a form is submitted.
Defaults to undefined.
Identifies the form that owns the hidden input. Useful when the checkbox is rendered outside the form.
Whether the checkbox is currently ticked. To render an uncontrolled checkbox, use the `defaultChecked` prop instead.
Defaults to undefined.
Whether the checkbox is initially ticked. To render a controlled checkbox, use the `checked` prop instead.
Defaults to false.
Whether the component should ignore user interaction.
Defaults to false.
Event handler called when the checkbox is ticked or unticked.
Whether the user should be unable to tick or untick the checkbox.
Defaults to false.
Whether the user must tick the checkbox before submitting a form.
Defaults to false.
Whether the checkbox is in a mixed state: neither ticked, nor unticked.
Defaults to false.
A ref to access the hidden `<input>` element.
Whether the checkbox controls a group of child checkboxes. Must be used in a [Checkbox Group](https://base-ui.com/react/components/checkbox-group).
Defaults to false.
The value submitted with the form when the checkbox is unchecked. By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.
The checkbox's value. Identifies it within a [Checkbox Group](https://base-ui.com/react/components/checkbox-group), falling back to `name` when omitted. When submitting a form, a checked box submits `value`; with no `value`, it submits the native "on".
CSS class applied to the element, or a function that returns a class based on the component's state.
Ignored inside a `CheckboxGroup`, which sets it for every item.
Inherited from NonNativeButtonProps
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button.
Defaults to false.
Names of the checkboxes in the group that should be ticked. To render an uncontrolled checkbox group, use the `defaultValue` prop instead.
Names of the checkboxes in the group that should be initially ticked. To render a controlled checkbox group, use the `value` prop instead.
Event handler called when a checkbox in the group is ticked or unticked. Provides the new value as an argument.
Names of all checkboxes in the group. Use this when creating a parent checkbox.
Whether the component should ignore user interaction.
Defaults to false.
CSS class applied to the element, or a function that returns a class based on the component's state.
No additional props. It forwards all standard HTML attributes to the underlying element.
No additional props. It forwards all standard HTML attributes to the underlying element.
CSS class applied to the element, or a function that returns a class based on the component's state.
Inherited from CheckboxRootProps
Identifies the form that owns the hidden input. Useful when the checkbox is rendered outside the form.
Whether the checkbox is initially ticked. To render a controlled checkbox, use the `checked` prop instead.
Defaults to false.
The id of the input element.
The checkbox's value. Identifies it within a [Checkbox Group](https://base-ui.com/react/components/checkbox-group), falling back to `name` when omitted. When submitting a form, a checked box submits `value`; with no `value`, it submits the native "on".
Identifies the field when a form is submitted.
Defaults to undefined.
Whether the checkbox is currently ticked. To render an uncontrolled checkbox, use the `defaultChecked` prop instead.
Defaults to undefined.
Whether the component should ignore user interaction.
Defaults to false.
Event handler called when the checkbox is ticked or unticked.
Whether the user should be unable to tick or untick the checkbox.
Defaults to false.
Whether the user must tick the checkbox before submitting a form.
Defaults to false.
Whether the checkbox is in a mixed state: neither ticked, nor unticked.
Defaults to false.
A ref to access the hidden `<input>` element.
Whether the checkbox controls a group of child checkboxes. Must be used in a [Checkbox Group](https://base-ui.com/react/components/checkbox-group).
Defaults to false.
The value submitted with the form when the checkbox is unchecked. By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.
Inherited from NonNativeButtonProps
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button.
Defaults to false.