Overview
Checkboxes use the Form.Check
as a wrapper and adding custom
prop. Custom checkbox and radio styles are achieved with a resourceful use of the :checked
selector and :after
pseudo elements, but are Structurally similar to the default FormCheck
.
Apply Bootstrap's custom elements by adding the custom
prop.
CheckboxesInline
API
Form
import Form from `@trimbleinc/modus-react-bootstrap/Form`
Name | Type | Default | Description |
---|---|---|---|
ref | ReactRef | The Form | |
as | elementType | <form> | |
inline | boolean | false | Display the series of labels, form controls, and buttons on a single horizontal row |
validated | boolean | Mark a form as having been validated. Setting it to | |
bsPrefix | string | {'form'} |
Form.Check
import Form.Check from `@trimbleinc/modus-react-bootstrap/Form.Check`
Name | Type | Default | Description |
---|---|---|---|
ref | ReactRef | The FormCheck | |
as | 'input' | elementType | 'input' | The underlying HTML element to use when rendering the FormCheck. |
children | node | Provide a function child to manually handle the layout of the FormCheck's inner components.
| |
custom | all(PropTypes.bool, ({ custom, id }) =>
custom && !id ? Error('Custom check controls require an id to work') : null,
) | Use Bootstrap's custom form elements to replace the browser defaults | |
disabled | boolean | false | Disables the control. |
feedback | node | A message to display when the input is in a validation state | |
feedbackTooltip | boolean | false | Display feedback as a tooltip. |
id | string | A HTML id attribute, necessary for proper form accessibility. An id is recommended for allowing label clicks to toggle the check control. This is required for custom check controls or when | |
inline | boolean | false | Groups controls horizontally with other |
isInvalid | boolean | false | Manually style the input as invalid |
isValid | boolean | false | Manually style the input as valid |
label | node | Label for the control. | |
title | string | '' |
|
type | 'radio' | 'checkbox' | 'switch' | 'checkbox' | The type of checkable. |
bsPrefix | string | 'form-check' | |
bsCustomPrefix | string | 'custom-control' | A seperate bsPrefix used for custom controls |
FormCheck.Input
import FormCheck.Input from `@trimbleinc/modus-react-bootstrap/FormCheck.Input`
Name | Type | Default | Description |
---|---|---|---|
as | 'input' | elementType | 'input' | The underlying HTML element to use when rendering the FormCheckInput. |
id | string | A HTML id attribute, necessary for proper form accessibility. | |
isInvalid | boolean | false | Manually style the input as invalid |
isStatic | boolean | A convenience prop shortcut for adding | |
isValid | boolean | false | Manually style the input as valid |
type | 'radio' | 'checkbox' | 'checkbox' | The type of checkable. |
bsPrefix | string | 'form-check-input' | |
bsCustomPrefix | string | 'custom-control' | A seperate bsPrefix used for custom controls |
FormCheck.Label
import FormCheck.Label from `@trimbleinc/modus-react-bootstrap/FormCheck.Label`
Name | Type | Default | Description |
---|---|---|---|
htmlFor | string | The HTML for attribute for associating the label with an input | |
bsPrefix | string | 'form-check-input' | |
bsCustomPrefix | string | 'custom-control' | A seperate bsPrefix used for custom controls |