Contributing Components
Use this checklist for every new or materially changed primitive.
Contract
Every primitive must satisfy the universal-component contract:
- source implementation in
src/packages/ui/src; - native variant or documented web-only rationale;
- same prop API across platforms when native exists;
- accepts
classNameon every visual root and visual sub-component, merged last throughcn(..., className); - accessible by default;
- AI-UI Zod schema when descriptor-renderable;
- Storybook story;
- docs-site content;
- wiki page;
docs/index.mdrow.
Naming
- Component: PascalCase.
- Hook: camelCase.
- File name matches the exported symbol.
- Package entry uses named exports only.
Design
- Use semantic tokens.
- Do not hardcode raw hex values in components.
- Use icons from
@mihcm/iconsor Lucide wrappers. - Include empty, disabled, loading, error, long text, RTL, and mobile cases where relevant.
Accessibility
At minimum:
- keyboard navigation;
- visible focus;
- 44px touch targets for mobile actions;
- correct ARIA roles and labels;
- screen reader behavior documented;
- color contrast at WCAG 2.1 AA.
Required Files
| Surface | Required |
|---|---|
| Source | src/packages/ui/src/<Name>.tsx |
| Native | src/packages/ui/src/<Name>.native.tsx or web-only rationale |
| Story | src/apps/storybook/src/<Name>.stories.tsx |
| Docs content | src/apps/docs/content/components/<slug>/ |
| Wiki | docs/components/<Name>.md |
| Registry | src/apps/docs/lib/registry.ts |
| Package export | src/packages/ui/package.json and src/packages/ui/src/index.ts |
| AI schema | src/packages/ai-ui/src/schemas/<Name>.ts when descriptor-renderable |
Verification
Run:
cd src
pnpm build
pnpm typecheck
pnpm lint
pnpm testThen use MCP:
mihcm_search_componentsbefore building;mihcm_check_contractbefore finishing;mihcm_validate_descriptorfor AI-UI schemas.