1.4 KiB
1.4 KiB
name, description, disable-model-invocation, argument-hint, context, agent
| name | description | disable-model-invocation | argument-hint | context | agent |
|---|---|---|---|---|---|
| component | Scaffold a new React component with TypeScript, accessibility, all states (loading, error, empty, success), and variant support via cva. | true | [ComponentName] | fork | frontend-architect |
Scaffold Component
Create a production-ready React component named $ARGUMENTS.
Requirements
-
Read project context first:
- Check
docs/frontend/architecture.mdfor component conventions - Check
RECOMMENDATIONS.mdfor locked stack decisions (styling, state management) - Look at existing components in
apps/web/for patterns to follow
- Check
-
Component structure:
- TypeScript with explicit props interface extending native HTML attributes
- Variants via
class-variance-authority(cva) if multiple visual variants needed - All states: loading (
aria-busy), error, empty, success - Forward ref if wrapping native elements
-
Accessibility (WCAG 2.2 AA):
- Semantic HTML elements (not div soup)
- ARIA attributes where needed (
aria-label,aria-describedby,aria-live) - Keyboard navigation support
- Focus management for interactive elements
- Color contrast compliance
-
Files to create:
ComponentName.tsx— component implementationComponentName.test.tsx— unit tests (Vitest + Testing Library, accessible queries)
-
Output: working code, not explanations. Include a brief usage example at the end.