Set of interactive cards where multiple options can be selected at a time.
<Box maxWidth="600px">
<CheckboxCards.Root defaultValue={["1"]} columns={{ initial: "1", sm: "3" }}>
<CheckboxCards.Item value="1">
<Flex direction="column" width="100%">
<Text weight="bold">A1 Keyboard</Text>
<Text>US Layout</Text>
</Flex>
</CheckboxCards.Item>
<CheckboxCards.Item value="2">
<Flex direction="column" width="100%">
<Text weight="bold">Pro Mouse</Text>
<Text>Zero-lag wireless</Text>
</Flex>
</CheckboxCards.Item>
<CheckboxCards.Item value="3">
<Flex direction="column" width="100%">
<Text weight="bold">Lightning Mat</Text>
<Text>Wireless charging</Text>
</Flex>
</CheckboxCards.Item>
</CheckboxCards.Root>
</Box>
This component is based on the div
element and supports common margin props.
Prop | Type | Default |
---|---|---|
asChild | boolean | No default value |
size | Responsive<"1" | "2" | "3"> | "2" |
variant | "surface" | "classic" | "surface" |
color | enum | No default value |
highContrast | boolean | No default value |
columns | Responsive<enum | string> | "repeat(auto-fit, minmax(200px, 1fr))" |
gap | Responsive<enum | string> | "4" |
An item in the group that can be checked.
Use the size
prop to control the size.
<Flex align="center" gap="3">
<CheckboxCards.Root defaultValue={["1"]} size="1">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} size="2">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} size="3">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
</Flex>
Use the variant
prop to control the visual style.
<Flex direction="column" gap="3" maxWidth="200px">
<CheckboxCards.Root defaultValue={["1"]} variant="surface">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} variant="classic">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
</Flex>
Use the color
prop to assign a specific color.
<Flex direction="column" gap="3" maxWidth="200px">
<CheckboxCards.Root defaultValue={["1"]} color="indigo">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="cyan">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="orange">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="crimson">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
</Flex>
Use the highContrast
prop to increase color contrast with the background.
<Grid columns="2" gap="3" display="inline-grid">
<CheckboxCards.Root defaultValue={["1"]} color="indigo">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="indigo" highContrast>
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="cyan">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="cyan" highContrast>
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="orange">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="orange" highContrast>
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="crimson">
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root defaultValue={["1"]} color="crimson" highContrast>
<CheckboxCards.Item value="1">Agree to Terms</CheckboxCards.Item>
</CheckboxCards.Root>
</Grid>
<Flex direction="column" gap="4" maxWidth="450px">
<CheckboxCards.Root columns="2" defaultValue="2">
<CheckboxCards.Item value="1">Off</CheckboxCards.Item>
<CheckboxCards.Item value="2">On</CheckboxCards.Item>
</CheckboxCards.Root>
<CheckboxCards.Root columns="2" defaultValue="2">
<CheckboxCards.Item value="1" disabled>
Off
</CheckboxCards.Item>
<CheckboxCards.Item value="2" disabled>
On
</CheckboxCards.Item>
</CheckboxCards.Root>
</Flex>