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