File: /var/www/design.system/src/molecules/Inputs/Checkbox/Checkbox.stories.tsx
import { Meta, StoryObj } from '@storybook/react';
import { useArgs } from '@storybook/preview-api'; // Импортируем хук useArgs
import Checkbox from './Checkbox.tsx';
const meta: Meta<typeof Checkbox> = {
component: Checkbox,
title: 'Molecules/Inputs/Checkbox',
tags: ['autodocs'],
argTypes: {
checked: {
control: 'boolean',
},
},
};
export default meta;
type Story = StoryObj<typeof Checkbox>;
export const Default: Story = {
render: function Render(args) {
const [{ checked }, updateArgs] = useArgs();
const handleChange = (value: boolean) => {
updateArgs({ checked: value });
};
return <Checkbox {...args} checked={checked} onChange={handleChange} />;
},
args: {
checked: false,
label: 'Label',
description: 'Description',
},
};