Tonic UI
Getting StartedColor ModeColor StyleVersionsContributing
THEME
BordersBreakpointsColorsOutlinesPositionsSpacingSizesShadowsTypography
BUILDING BLOCKS
BoxControlBox
UTILITIES

ControlBox

ControlBox provides style props to change it's styles based on a sibling checkbox or radio input. It relies on a common CSS technique for styling custom controls.

For this component to work, it should have a sibling input and be contained in a label.

Usage

Creating a custom checkbox component

EDITABLE EXAMPLE

Creating a custom radio component

EDITABLE EXAMPLE

Props

By default, it toggles the opacity of the ControlBox children by setting _child to { opacity: 0 } and _checkedAndChild to { opacity: 1 }.

NameSelectorDescription
_child[input] + & > *Styles for the child of the ControlBox.
_disabled[input]:disabled + &Styles for when the sibling input is disabled.
_focus[input]:focus + &Styles for when the sibling input is focused.
_hover[input]:hover:not(:disabled):not(:checked):not(:focus) + &Styles for when the sibling input is hovered.
_checked[input]:checked + &Styles for when the sibling input is checked.
_checkedAndActive[input]:checked:active:not(:disabled):not(:focus) + &Styles for when the sibling input is checked and actived.
_checkedAndChild[input]:checked + & > *Styles for the child of the ControlBox when the sibling input is checked.
_checkedAndDisabled[input]:checked:disabled + &Styles for when the sibling input is checked and disabled.
_checkedAndFocus[input]:checked:focus + &Styles for when the sibling input is checked and focused.
_checkedAndHover[input]:checked:hover:not(:disabled):not(:focus) + &Styles for when the sibling input is checked and hovered.
_indeterminate[input][data-indeterminate=true] + &Styles for when the sibling input is indeterminate.
_indeterminateAndActive[input][data-indeterminate=true]:active:not(:disabled):not(:focus) + &Styles for when the sibling input is indeterminate and actived.
_indeterminateAndChild[input][data-indeterminate=true] + & > *Styles for the child of the ControlBox when the sibling input is indeterminate.
_indeterminateAndDisabled[input][data-indeterminate=true]:disabled + &Styles for when the sibling input is indeterminate and disabled.
_indeterminateAndFocus[input][data-indeterminate=true]:focus + &Styles for when the sibling input is indeterminate and focused.
_indeterminateAndHover[input][data-indeterminate=true]:hover:not(:disabled):not(:focus) + &Styles for when the sibling input is indeterminate and hovered.