Stack-and-Flow is an educational, accessible design system that can be published as an npm package, built with React, TypeScript, Tailwind CSS v4, Radix UI primitives, CVA, Storybook, and Vite.
The goal is to learn and practice how a real component library is built: tokens, architecture, living documentation, tests, accessibility, visual review, and a GitHub Projects contribution workflow.
git clone https://github.com/Stack-and-Flow/design-system.git
cd design-system
nvm use
pnpm install
pnpm run storybookStorybook is available at http://localhost:6006.
Public demo: sf-design-system.netlify.app
Every component lives in src/components/{atoms|molecules|organisms}/{kebab-name}/ and uses the mandatory 6-file pattern:
src/components/atoms/button/
├── types.ts # Props, public types, and CVA variants
├── useButton.ts # Logic, state, handlers, aria, and computed className
├── Button.tsx # Presentational JSX; consumes the hook
├── Button.test.tsx # Hook tests and component behavior tests
├── Button.stories.tsx # Storybook autodocs, args, variants, and states
└── index.ts # Named component export + type exports
Base rules:
- Use
type, neverinterface. - No explicit
any. - CVA lives in
types.ts. - The component
.tsxcontains no logic and no CVA calls. - Public imports/exports are named, for example
import { Button } from '@stack-and-flow/design-system'. - Storybook uses JSDoc above
const metaand above everyexport const StoryName. - Do not use
parameters.docs.description.component.
This project uses GitHub Issues + GitHub Projects as the source workflow.
Short path:
- Pick an issue from the Project Board.
- Before implementing, verify that the spec is defined and the issue has the
status:approvedlabel. - Only then run START WORK:
- assign the issue to the contributor;
- move the Project item to
In progress; - record the branch and worktree.
- Use issue-based branch names:
feat/{issue-number}-{slug}fix/{issue-number}-{slug}docs/{issue-number}-{slug}
- If you need a worktree, create it as a sibling of the repo:
../design-system-{type}-{issue-number}-{slug}- not under
/tmp, unless explicitly requested.
- Implement with the 6-file pattern.
- Run tests/build/visual review as needed.
- Before commit/review, clean MCP artifacts:
rm -rf .playwright-mcp page-*.png page-*.jpeg *.md.playwright-output- When closing, run END WORK only with a merged PR or explicit maintainer/user approval, plus validation evidence.
Recommended docs:
- We only use Radix UI primitives as unstyled base primitives.
- We do not use shadcn as a component source or configuration layer.
- Use tokens from
src/styles/theme.css; do not hardcode colors, fonts, or spacing. - If a token is missing, propose adding it centrally before using raw values.
- Accessibility is mandatory: accessible name, keyboard behavior, visible focus, contrast, reduced motion.
- Code, comments, Storybook, and public names are in English.
pnpm run storybook # Local Storybook
pnpm run test # Vitest
pnpm run test:coverage # Coverage
pnpm run build # Library build + typesPlaywright MCP is optional infrastructure for AI agents. It may generate artifacts such as .playwright-mcp/, page-*.png, page-*.jpeg, or *.md.playwright-output.
These files are never committed. Before commit or review:
rm -rf .playwright-mcp page-*.png page-*.jpeg *.md.playwright-output- Live Storybook: sf-design-system.netlify.app
- Project Board: GitHub Projects
- Deepwiki Wiki: deepwiki.com/Stack-and-Flow/design-system
This repository is open to collaboration. It is a good place to learn design systems, React, TypeScript, component architecture, accessibility, Storybook, and package publishing.
⭐ If you find this project useful, consider giving it a star on GitHub ⭐