
Storybook Has a Free API That Turns Component Development Into a Design System
Storybook is the UI workshop for building components in isolation. Its API lets you document, test, and showcase every component state. Write a Story import type { Meta , StoryObj } from " @storybook/react " ; import { Button } from " ./Button " ; const meta : Meta < typeof Button > = { title : " Components/Button " , component : Button , tags : [ " autodocs " ], argTypes : { variant : { control : " select " , options : [ " primary " , " secondary " , " danger " ] }, size : { control : " radio " , options : [ " sm " , " md " , " lg " ] }, disabled : { control : " boolean " }, onClick : { action : " clicked " }, }, }; export default meta ; type Story = StoryObj < typeof Button > ; export const Primary : Story = { args : { variant : " primary " , children : " Click me " , size : " md " }, }; export const Secondary : Story = { args : { variant : " secondary " , children : " Cancel " }, }; export const Disabled : Story = { args : { variant : " primary " , children : " Disabled " , disabled
Continue reading on Dev.to React
Opens in a new tab



