A checkbox component that can be used to trigger actions.
import { Checkbox } from '@backstage/ui';
<Checkbox>Accept terms</Checkbox>| Prop | Type | Default | Responsive |
|---|---|---|---|
| children | React.ReactNode | - | No |
| isSelected | boolean | - | No |
| defaultSelected | boolean | - | No |
| onChange | (isSelected: boolean) => void | - | No |
| isDisabled | boolean | - | No |
| isRequired | boolean | - | No |
| name | string | - | No |
| value | string | - | No |
| className | string | - | No |
| style | CSSProperties | - | No |
Here's a view when checkboxes have different variants.
<Flex direction="column" gap="2">
<Checkbox>Unchecked</Checkbox>
<Checkbox isSelected>Checked</Checkbox>
<Checkbox isDisabled>Disabled</Checkbox>
<Checkbox isSelected isDisabled>Checked & Disabled</Checkbox>
</Flex>Our theming system is based on a mix between CSS classes, CSS variables and data attributes. If you want to customise this component, you can use one of these class names below.
bui-Checkboxbui-Checkbox[data-selected="true"]bui-Checkbox[data-selected="false"]bui-CheckboxIndicator