lloydrichards.dev

DEVELOP

January 24, 2025
shadcn Storybook Registry
Installable Storybook stories for shadcn/ui components, with examples for Radix UI, Base UI, and React Aria.

When I add a shadcn/ui component to a project, I get the source code and can change it to fit the design. I still have to write the stories that show which variants exist and how the component behaves. I built a registry for those stories so I could install them with the same CLI I was already using for the components.

Open the Radix Button stories, then run this in a project with shadcn/ui and Storybook configured to install the story.

npx shadcn@latest add https://registry.lloydrichards.dev/v3/radix/button-story.json

Project Overview

The registry lets you browse stories, try them in Storybook, and copy the install command for the component you want. The story lands in your project as source code, where you can adapt it to the component and theme you actually ship. The published collections include component examples, interaction tests, and reference stories for tokens such as colour and typography.

Challenges and Insights

Matching the Component You Installed

A story has to match the component it imports. A Radix UI example can look much like its Base UI counterpart in Storybook, even when the props or composition differ. The registry publishes separate entries for Radix UI, Base UI, and React Aria so you can pick the one that matches your project. The setup guide covers the other half of the install, including where Storybook finds the stories and how it loads your project's styles.