SelectableBox
Leave feedbackA 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
Any Paragon component or export may be added to the code example.
As Radio
Any Paragon component or export may be added to the code example.
As Checkbox
As Checkbox with isIndeterminate
Any Paragon component or export may be added to the code example.
As Checkbox with ariaLabelledby
Any Paragon component or export may be added to the code example.
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;
Props API#
- children
nodeRequiredContent of the
SelectableBox. - value
string|numberA value that is passed to the input tag.
- checked
boolDefaultfalseControls whether
SelectableBoxis checked. - type
enum'radio' | 'checkbox'Default'radio'Indicates the input type: checkbox or radio.
- onClick
funcDefault() => {}Function that is called when the
SelectableBoxis clicked. - onFocus
funcDefault() => {}Function that is called when the
SelectableBoxis focused. - inputHidden
boolDefaulttrueControls display of the input (checkbox or radio button) on the
SelectableBox. - isIndeterminate
boolDefaultfalseIndicates a state for the 'checkbox'
typewhenSelectableBoxis neither checked nor unchecked. - isInvalid
boolDefaultfalseAdds errors styles to the
SelectableBox. - className
stringA class that is appended to the base element.
- name
stringRequiredSpecifies a name for the group of
SelectableBox'es. - children
nodeContent of the
SelectableBoxSet. - onChange
funcDefault() => {}A function that receives event of the clicked
SelectableBoxand can be used to handle the value change. - value
string|number|arrayIndicates selected
SelectableBox'es. - defaultValue
string|numberSpecifies default values for the
SelectableBox'es. - type
enum'radio' | 'checkbox'Default'radio'Indicates the input type: checkbox or radio.
- columns
numberDefault2Specifies 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
stringA class that is be appended to the base element.
- ariaLabelledby
stringThe ID of the label for the
SelectableBoxSet.An accessible label must be provided to the
SelectableBoxSet. - ariaLabel
requiredWhenNot(PropTypes.string, 'ariaLabelledby')A label for the
SelectableBoxSet.If not using
ariaLabelledby, thenariaLabelmust be provided
Usage Insights#
SelectableBox
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-course-authoring | 20.35.1 | 1 | |
| frontend-app-enterprise-public-catalog | 20.29.0 | 3 | |
| frontend-app-learner-portal-enterprise | 20.45.1 | 1 | |
| frontend-app-learner-record | 20.45.0 | 1 | |
| frontend-lib-content-components | 20.45.0 | 2 |
SelectableBoxSet
| Project Name | Paragon Version | Instance Count | |
|---|---|---|---|
| frontend-app-course-authoring | 20.35.1 | 1 | |
| frontend-app-enterprise-public-catalog | 20.29.0 | 1 | |
| frontend-app-learner-portal-enterprise | 20.45.1 | 1 | |
| frontend-app-learner-record | 20.45.0 | 1 | |
| frontend-lib-content-components | 20.45.0 | 2 |