Skip to content

Checkbox

Allow users to make binary choices or select multiple options.

import { useState } from 'react';
// Import component
import { Checkbox } from '@fintech-sandpit/ui/react';
// Import styles (optional)
import '@fintech-sandpit/ui/style/components/checkbox.css';
return (
<Checkbox
defaultChecked={false}
disabled={false}
invalid={false}
readOnly={false}
value="accepted"
colorScheme="neutral"
size="md"
variant="solid"
labelPosition="left"
>
Accept terms and conditions
</Checkbox>
);
NameTypeDefaultDescription
checkedCheckedState—The controlled checked state of the checkbox
defaultCheckedCheckedStatefalseThe default (uncontrolled) checked state of the checkbox
formstring—The id of the checkbox form
namestring—The name of the input field on the form
valuestring—The checkbox value for form submission
colorSchemeColorSchemeneutralThe checkbox color scheme
sizeSizemdThe checkbox size
variantCheckboxVariantsolidThe checkbox variant
disabledbooleanfalseWhether the checkbox is disabled
invalidbooleanfalseWhether the checkbox is invalid
readOnlybooleanfalseWhether the checkbox is read-only
tabIndexnumber—The tab index of the checkbox hidden input element
labelPositionLabelPositionleftThe position of the label
NameTypeDescription
onCheckedChange(value: CheckedState) => voidCallback fired when the checked state changes
type CheckboxVariant = 'solid' | 'subtle' | 'outline'
type CheckedState = boolean | 'indeterminate'
type ColorScheme = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger'
type LabelPosition = 'left' | 'right'
type Size = 'xs' | 'sm' | 'md' | 'lg'