/* ! * (c) Copyright 2026 Palantir Technologies Inc. All rights reserved. */ import type { Meta, StoryObj } from "@storybook/react-vite"; import { storybookLayoutDecorator, StoryLabel } from "@storybook-common"; import { Flex } from "@blueprintjs/labs"; import { Intent } from "../../common"; import { Checkbox } from "./controls"; const disabledArgs = ["large", "tagName", "labelElement", "inputRef"] as const satisfies ReadonlyArray< keyof React.ComponentProps >; const meta: Meta = { title: "Core/Form/Controls/Checkbox", component: Checkbox, decorators: [storybookLayoutDecorator], tags: ["autodocs"], args: { label: "Checkbox", disabled: false, inline: false, size: "medium", }, argTypes: { size: { control: "select", options: ["medium", "large"], }, disabled: { control: "boolean", }, inline: { control: "boolean", }, indeterminate: { control: "boolean", }, defaultChecked: { control: "boolean", }, onChange: { action: "changed" }, ...disabledArgs.reduce( (acc, argName) => { acc[argName] = { table: { disable: true } }; return acc; }, {} as Record<(typeof disabledArgs)[number], { table: { disable: boolean } }>, ), }, } satisfies Meta; export default meta; type Story = StoryObj; /** * A basic checkbox with default styling. */ export const Default: Story = { args: { label: "Enable notifications", }, }; /** * Use the `size` prop to adjust the checkbox dimensions. */ export const SizeExample: Story = { name: "Size", argTypes: { size: { table: { disable: true } }, }, render: args => ( ), }; /** * Checkboxes support `disabled`, `indeterminate`, and `inline` states. */ export const StateExample: Story = { name: "State", argTypes: { disabled: { table: { disable: true } }, indeterminate: { table: { disable: true } }, inline: { table: { disable: true } }, }, render: args => (
), }; /** * All states across all sizes. */ export const AllStatesAllSizes: Story = { name: "All States All Sizes", render: args => ( {(["medium", "large"] as const).map(size => (
))}
), }; /** * Interactive playground with all props togglable via Storybook controls. */ export const Playground: Story = { args: { label: "Enable feature", defaultChecked: false, }, };