sahilrajput03

Learn Storybook

Quick Links in Docs:

typescript error:

Way1 Custom Args type:

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

type SwitchStory = ComponentStory<typeof Switch>;

const Template: SwitchStory = (args) => <Switch {...args} />;

export const Checked: SwitchStory = Template.bind({});
Checked.args = {
  isChecked: false,
};
export const UnChecked: SwitchStory = Template.bind({});
Checked.args = {
  isChecked: true,
};

Generic Args Type:

import { Story } from '@storybook/react';

const Template: Story = (args: any) => <Switch {...args} />;

export const Checked: Story = Template.bind({});
Checked.args = {
  // Beware: props are not typeschecked here
  isChecked: false,
};