diff --git a/packages/timo-design-system/src/components/checkbox/Checkbox.stories.tsx b/packages/timo-design-system/src/components/checkbox/Checkbox.stories.tsx new file mode 100644 index 00000000..6769c3f3 --- /dev/null +++ b/packages/timo-design-system/src/components/checkbox/Checkbox.stories.tsx @@ -0,0 +1,50 @@ +import { useState } from "react"; + +import { Checkbox } from "./Checkbox"; + +import type { Meta, StoryObj } from "@storybook/react"; + +const meta: Meta = { + title: "Components/Checkbox", + component: Checkbox, + argTypes: { + checked: { control: "boolean" }, + disabled: { control: "boolean" }, + }, + args: { + checked: false, + disabled: false, + onChange: () => {}, + }, +}; + +export default meta; +type Story = StoryObj; + +const PlaygroundCheckbox = (args: React.ComponentProps) => { + const [checked, setChecked] = useState(args.checked); + return ; +}; + +export const Playground: Story = { + render: (args) => , +}; + +export const AllStates: Story = { + render: () => ( +
+
+ {}} /> +

Unchecked

+
+
+ {}} /> +

Checked

+
+
+ {}} /> +

Disabled

+
+
+ ), +}; diff --git a/packages/timo-design-system/src/components/checkbox/Checkbox.tsx b/packages/timo-design-system/src/components/checkbox/Checkbox.tsx new file mode 100644 index 00000000..ba436f62 --- /dev/null +++ b/packages/timo-design-system/src/components/checkbox/Checkbox.tsx @@ -0,0 +1,65 @@ +import { cn } from "@lib"; +import { useId } from "react"; + +export interface CheckboxProps { + checked: boolean; + onChange: (checked: boolean) => void; + disabled?: boolean; + className?: string; +} + +export const Checkbox = ({ + checked, + onChange, + disabled = false, + className, +}: CheckboxProps) => { + const id = useId(); + return ( + + ); +}; diff --git a/packages/timo-design-system/src/components/index.ts b/packages/timo-design-system/src/components/index.ts index 9ae8ca5a..579ad403 100644 --- a/packages/timo-design-system/src/components/index.ts +++ b/packages/timo-design-system/src/components/index.ts @@ -1,3 +1,4 @@ +export { Checkbox } from "./checkbox/Checkbox"; export { Color } from "./color/Color"; export { Typography } from "./typography/Typography"; export { Tag } from "./tag/Tag";