<Checkbox>
A headless Checkbox component for ReactLynx. It supports controlled/uncontrolled checked state and indeterminate mode.
Basic Usage
The most basic usage of the <Checkbox>
Indeterminate State
The indeterminate state is used when a <Checkbox> represents a group of options where some, but not all, are selected
Structure
API
Checkbox
checkboxPropsiOSAndroid
Checkbox supports original view props to be directly spread in this prop.
checkediOSAndroid
Whether the Checkbox is checked. If this property is set, the Checkbox will be in controlled mode, meaning the defaultChecked property will take no effects.
classNameiOSAndroidHarmony
className
defaultCheckediOSAndroid
Determines whether the Checkbox is checked by default. Use this property means the Checkbox is uncontrolled.
disablediOSAndroid
Disables the Checkbox. The Checkbox cannot be interacted with.
indeterminateiOSAndroid
The indeterminate state of the Checkbox.
onChangeiOSAndroid
The callback function that is triggered when the state changes
styleiOSAndroidHarmony
style
childreniOSAndroid
children
State-based styling & rendering
This component exposes each of its internal states through two interchangeable channels, and the table below maps them one-to-one:
- CSS className — a class like
ui-<state>is toggled on the root node, so you can style it with selectors such as.ui-<state> { ... }. - Render-prop field — when
childrenis a function, the same state is passed in viachildren({ <state>: boolean, ... })for runtime-driven rendering.
ui-checked
Whether the checkbox is currently checked.
Applied when `status.checked` is true.
ui-indeterminate
Whether the checkbox is in an indeterminate state.
Applied when `status.indeterminate` is true.
ui-active
Whether the checkbox is currently being pressed (and not disabled).
Applied when `status.active` is true.
ui-disabled
Whether the checkbox is disabled.
Applied when `status.disabled` is true.
CheckboxIndicator
childreniOSAndroid
The indicator of the Checkbox. Only displays child nodes when checked or indeterminate is true. If you need to keep it displayed when checked or indeterminate is false, set forceMount to true.
classNameiOSAndroidHarmony
className
forceMountiOSAndroid
Force mount the children. If set to true, the children will always be mounted even when checked or indeterminate is false.
styleiOSAndroidHarmony
style