A React component library built with TypeScript, TailwindCSS, and Vite. Created as part of the Build A React UI Library series.
- TypeScript-first component library
- TailwindCSS utility styling
- ESM + UMD bundles
- Vitest + React Testing Library coverage
- Storybook docs with
@storybook/react-vite - Bundled type declarations
npm install cottage-uiimport { Button, BUTTON_VARIANTS, BUTTON_SIZES } from 'cottage-ui'
import 'cottage-ui/dist/cottage-ui.css'
function App() {
return (
<Button
variant={BUTTON_VARIANTS.PRIMARY}
size={BUTTON_SIZES.LARGE}
onClick={() => console.log('Clicked!')}
>
Click me
</Button>
)
}This repo uses npm.
npm install
npm run dev
npm run storybook
npm run lint
npm run test -- --run
npm run buildcottage-ui/
├── lib/ # Published library source
├── src/ # Local demo app
├── .storybook/ # Storybook config
└── dist/ # Build outputs
- Add or update code in
lib/ - Add/adjust tests and stories
- Export new APIs in
lib/main.ts - Run lint, tests, and build before opening a PR
- AGENTS.md - Agent and component architecture conventions
- CLAUDE.md - AI coding-agent guidance
- CREATE_COMPONENT_PROMPT.md - Step-by-step component creation workflow
- lib/README.md - Library directory-specific guidance
See package.json.
