@antjanus/cottage-ui
v2.0.0
Published
React component library with cottage-style UI primitives for consistent, accessible interfaces.
Downloads
268
Readme
Cottage UI
A React component library built with TypeScript, TailwindCSS, and Vite. Created as part of the Build A React UI Library series.
Demo

Features
- TypeScript-first component library
- TailwindCSS utility styling
- ESM + UMD bundles
- Vitest + React Testing Library coverage
- Storybook docs with
@storybook/react-vite - Bundled type declarations
Installation
npm install @antjanus/cottage-uiUsage
import { Button, BUTTON_VARIANTS, BUTTON_SIZES } from '@antjanus/cottage-ui'
import '@antjanus/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>
)
}Theming
Cottage UI ships four themes — cottage (the signature AJ palette: warm clay, amber, pine & teal), graphite, evergreen, and bloom — each with a light and dark mode. Components are styled by semantic role, so switching theme recolors the whole library.
Set data-theme (and optionally data-mode="dark") on any ancestor element:
<html data-theme="cottage"> <!-- light, default theme -->
<html data-theme="graphite" data-mode="dark">With no attributes set, the default is cottage / light. Switch at runtime by updating the attributes:
document.documentElement.dataset.theme = 'evergreen'
document.documentElement.dataset.mode = 'dark'Status -strong-on--soft pairs (badges, alerts) are WCAG AA verified in both modes.
The local demo (npm run dev) includes a theme/mode switcher and a palette showcase.
Development
This repo uses npm.
npm install
npm run dev
npm run storybook
npm run lint
npm run test -- --run
npm run buildProject Layout
cottage-ui/
├── lib/ # Published library source
├── src/ # Local demo app
├── .storybook/ # Storybook config
└── dist/ # Build outputsContributing
- 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
Documentation
- 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
License
MIT. See LICENSE.
Contributing
See CONTRIBUTING guidelines: add code in lib/, add tests and stories, export from lib/main.ts, then run lint/test/build before opening a PR.
