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;
- children
node
Required RequiredContent of the
SelectableBox
. - value
string
Required |number
Required RequiredA value that is passed to the input tag.
- checked
bool
RequiredDefaultfalseControls whether
SelectableBox
is checked. - type
enum
Required'radio' | 'checkbox'Default'radio'Indicates the input type: checkbox or radio.
- onClick
func
RequiredDefault() => {}Function that is called when the
SelectableBox
is clicked. - onFocus
func
RequiredDefault() => {}Function that is called when the
SelectableBox
is focused. - inputHidden
bool
RequiredDefaulttrueControls display of the input (checkbox or radio button) on the
SelectableBox
. - isIndeterminate
bool
RequiredDefaultfalseIndicates a state for the 'checkbox'
type
whenSelectableBox
is neither checked nor unchecked. - isInvalid
bool
RequiredDefaultfalseAdds errors styles to the
SelectableBox
. - className
string
RequiredA class that is appended to the base element.
- name
string
Required RequiredSpecifies a name for the group of
SelectableBox
'es. - children
node
RequiredContent of the
SelectableBoxSet
. - onChange
func
RequiredDefault() => {}A function that receives event of the clicked
SelectableBox
and can be used to handle the value change. - value
string
Required |number
Required |array
Required RequiredIndicates selected
SelectableBox
'es. - defaultValue
string
Required |number
Required RequiredSpecifies default values for the
SelectableBox
'es. - type
enum
Required'radio' | 'checkbox'Default'radio'Indicates the input type: checkbox or radio.
- columns
number
RequiredDefault2Specifies 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
. - className
string
RequiredA class that is be appended to the base element.