Skip to content

Add a component

Each export in a canvas file becomes a live card.

Create a *.canvas.tsx file beside your component. Import it and export a no-argument React component for each variant; each export becomes a live card.

// button.canvas.tsx
import { Button } from "./button";

export const Primary = () => <Button>Download for Mac</Button>;
export const Disabled = () => <Button disabled>Download for Mac</Button>;

Pass required props in the example. Changes appear live as you save.

Resizing cards

To resize a card (drag its edge, or pick a device), don't fix its width: write w-[1200px] max-w-full instead of w-[1200px]. A card you resize renders in a viewport of that width, like a page, so its md: and lg: styles follow it.