Accessible component library

Build a small set of reusable controls with documented behavior and states.

Customize the recipe

0/1500 characters
Workflow boosters

Prompt preview

# Accessible component library

Build a small set of reusable controls with documented behavior and states.

## Deliverable
A versioned library foundation, usage examples and keyboard tests.

## Stack and visual direction
- Recommended starting stack: React and TypeScript with semantic CSS variables. Use Storybook when isolated examples serve the deliverable.
- Swiss grid: Use a visible modular grid, aligned baselines, asymmetric composition and tight typographic hierarchy. Reflow the grid without shrinking essential text. Apply this direction to the interface while keeping data and controls easy to read.

- Inspect the workspace first. Adapt to its stack when it contains a project, or use the recommended starting stack in a new workspace.

## Tools and setup · Universal
Use the receiving agent’s documented skill and tool mechanisms. Match setup to the agent and workspace you actually have.

Check available tools first. Propose documented project-level setup only when it materially helps and follow the host's permission prompts. If a tool or integration is unavailable, continue with the workflow below using existing tools, local fixtures or a manual check. Keep secrets in the intended configuration environment.

- [shadcn/ui Skill](https://ui.shadcn.com/docs/skills) (Skill) — Inspect the project's component registry and assemble accessible UI primitives.
  Project with compatible React and styling configuration. Follow the skill's agent-specific setup. Fallback: Reuse established controls in the project, or start with semantic native controls and test keyboard and error states.
- [Radix Primitives](https://github.com/radix-ui/primitives) (Repository) — Start with established semantics and focus behavior for dialogs, menus and controls.
- [Storybook](https://github.com/storybookjs/storybook) (Repository) — Exercise reusable components and document visual and interactive states in isolation.
- [axe-core](https://github.com/dequelabs/axe-core) (Repository) — Find programmatically detectable accessibility issues and verify manual checks separately.
- [WCAG 2.2](https://www.w3.org/TR/WCAG22/) (Standard) — Use the relevant WCAG AA criteria for manual and automated web checks.

## Workflow
1. Start with buttons, fields and a dialog using accessible primitives. Document focus behavior, error announcements and state styles, then exercise examples in isolation.
2. Use the simplest implementation that delivers the stated outcome. Follow the user's project constraints and treat the starting stack as a default. Reuse existing work and ask for essential input only when it would change the result. Use realistic labeled sample data when real inputs are unavailable.
3. Run the applicable checks and report what actually passed along with any checks you could not run.

## Acceptance checks
- [ ] Dialog focus enters, stays in scope and returns to its trigger on dismissal.
- [ ] Field names, errors and disabled states are exposed appropriately.
- [ ] Walk the primary journey with keyboard only. Check visible focus, logical order, accessible names, readable contrast, zoom and reduced motion. Use axe where available and manually check behavior that automation cannot assess.
- [ ] Verify real actions and persisted data where required. Exercise relevant loading, empty, invalid, pending, failure and success states. Provide a clear recovery path.
- [ ] Use fixtures to verify core flows, including a narrow-screen layout and any applicable permission boundaries.

Recipe resources

Source, setup, and compatibility details.