Back to Twenty

Checkbox

packages/twenty-docs/twenty-ui/input/checkbox.mdx

2.2.01.3 KB
Original Source
<Frame> </Frame>

Used when a user needs to select multiple values from several options.

<Tabs> <Tab title="Usage">
jsx
import { Checkbox } from "twenty-ui/display";

export const MyComponent = () => {
  return (
    <Checkbox
      checked={true}
      indeterminate={false}
      onChange={() => console.log("onChange function fired")}
      onCheckedChange={() => console.log("onCheckedChange function fired")}
      variant="primary"
      size="small"
      shape="squared"
    />
  );
};
</Tab> <Tab title="Props">
PropsTypeDescription
checkedbooleanIndicates whether the checkbox is checked
indeterminatebooleanIndicates whether the checkbox is in an indeterminate state (neither checked nor unchecked)
onChangefunctionThe callback function you want to trigger when the checkbox state changes
onCheckedChangefunctionThe callback function you want to trigger when the checked state changes
variantstringThe visual style variant of the box. Options include: primary, secondary, and tertiary
sizestringThe size of the checkbox. Has two options: small and large
shapestringThe shape of the checkbox. Has two options: squared and rounded
</Tab> </Tabs>