CheckboxGroup

A checkbox group handles the spacing and orientation for a grouping of checkboxes, as well as providing a label.

Props

necessityIndicator?

Whether the required state should be shown as an asterisk or a label, which would display (Optional) on all non required field labels.

orientation?

A CheckboxGroup can be displayed horizontally or vertically.

Defaults to vertical.
size?

A CheckboxGroup can vary in size.

Defaults to md.
variant?

A CheckboxGroup has two variants: borderless and bordered.

Defaults to borderless.
style?

The inline style for the element. A function may be provided to compute the style based on component state.

children?

The children of the component. A function may be provided to alter the children based on component state.

validationBehavior?

Whether to use native HTML form validation to prevent form submission when the value is missing or invalid, or mark the field as required or invalid via ARIA.

Defaults to 'native'.
value?

The current value (controlled).

defaultValue?

The default value (uncontrolled).

onChange?

Handler that is called when the value changes.

isDisabled?

Whether the input is disabled.

isReadOnly?

Whether the input can be selected but not changed by the user.

name?

The name of the input element, used when submitting an HTML form. See MDN.

isRequired?

Whether user input is required on the input before form submission.

isInvalid?

Whether the input value is invalid.

validate?

A function that returns an error message if a given value is invalid. Validation errors are displayed to the user when the form is submitted if validationBehavior="native". For realtime validation, use the isInvalid prop instead.

id?

The element's unique identifier. See MDN.

className?

The CSS className for the element. A function may be provided to compute the class based on component state.

onFocus?

Handler that is called when the element receives focus.

onBlur?

Handler that is called when the element loses focus.

onFocusChange?

Handler that is called when the element's focus status changes.

aria-label?

Defines a string value that labels the current element.

aria-labelledby?

Identifies the element (or elements) that labels the current element.

aria-describedby?

Identifies the element (or elements) that describes the object.

aria-details?

Identifies the element (or elements) that provide a detailed, extended description for the object.

aria-errormessage?

Identifies the element that provides an error message for the object.

slot?

A slot name for the component. Slots allow the component to receive props from a parent component. An explicit null value indicates that the local props completely override all props received from a parent.

Anatomy

Composed Components

Examples

Read-only

A checkbox group can be read-only.

Disabled

A checkbox group can be disabled.

Invalid

A checkbox group can be invalid.

Sizes

A checkbox group can vary in size.

Label

A checkbox group can have a label to provide more context to the user.

Description

A checkbox group can have a description to provide more information to the user.

Bordered

A checkbox group can be bordered.

Orientation

A checkbox group can have a different orientation.

Controlled

A checkbox group can handle value state in controlled mode.

Migration Notes

Coming from Orbiter, you should be aware of the following changes:

  • onChange signature has been changed – no events are passed.
  • disabled has been renamed to isDisabled.
  • required has been renamed to isRequired.
  • fluid has been removed.
  • reverse is not supported, use flex-direction or row-reverse instead.
  • autofocus is not supported. You must put autofocus on the actual Checkbox.
  • The default orientation is now vertical instead of horizontal.
  • validationState is removed. use isInvalid instead. There is no isValid.
  • wrap is removed. If horizontal, radios will wrap.
  • There is no align prop. If needed, the styled system can be used.
  • The inline prop is not available.