fbredius/storybook

View on GitHub
docs/snippets/react/checkbox-story-csf.ts.mdx

Summary

Maintainability
Test Coverage
```ts
// Checkbox.stories.ts|tsx

import React from 'react';

import { ComponentMeta, ComponentStory } from '@storybook/react';

import { Checkbox } from './Checkbox';

export default {
  /* 👇 The title prop is optional.
  * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
  * to learn how to generate automatic titles
  */
  title: 'Checkbox', 
  component: Checkbox,
} as ComponentMeta<typeof Checkbox>;

export const allCheckboxes: ComponentStory<typeof Checkbox> = () => (
  <form>
    <Checkbox id="Unchecked" label="Unchecked" />
    <Checkbox id="Checked" label="Checked" checked />
    <Checkbox appearance="secondary" id="second" label="Secondary" checked />
  </form>
);
```