SelectableBox
A box that has selection states. It can be used as an alternative to a radio button or checkbox set.
The SelectableBox can contain any kind of content as long as it is not clickable. In other words, there should be no clickable targets distinct from selection.
Basic Usage
As Checkbox
As Radio
As Checkbox with isIndeterminate
Theme Variables (SCSS)#
$selectable-box-padding: 1rem !default;$selectable-box-border-radius: .25rem !default;$selectable-box-space: .75rem !default;$min-cols-number: 1 !default;$max-cols-number: 12 !default;
- childrennodeRequiredContent of the SelectableBox.
- valuestring|numberA value that is passed to the input tag. 
- checkedboolDefaultfalseControls whether SelectableBoxis checked.
- typeenum'radio' | 'checkbox'Default'radio'Indicates the input type: checkbox or radio. 
- onClickfuncDefault() => {}Function that is called when the SelectableBoxis clicked.
- onFocusfuncDefault() => {}Function that is called when the SelectableBoxis focused.
- inputHiddenboolDefaulttrueControls display of the input (checkbox or radio button) on the SelectableBox.
- isIndeterminateboolDefaultfalseIndicates a state for the 'checkbox' typewhenSelectableBoxis neither checked nor unchecked.
- isInvalidboolDefaultfalseAdds errors styles to the SelectableBox.
- classNamestringA class that is appended to the base element. 
- namestringRequiredSpecifies a name for the group of SelectableBox'es.
- childrennodeContent of the SelectableBoxSet.
- onChangefuncDefault() => {}A function that receives event of the clicked SelectableBoxand can be used to handle the value change.
- valuestring|number|arrayIndicates selected SelectableBox'es.
- defaultValuestring|numberSpecifies default values for the SelectableBox'es.
- typeenum'radio' | 'checkbox'Default'radio'Indicates the input type: checkbox or radio. 
- columnsnumberDefault2Specifies number of SelectableBox'es in a row.Class that is responsible for the columns number: pgn__selectable_box-set--{columns}. Max number of columns:12.
- classNamestringA class that is be appended to the base element.