Frontend component build

Build production-ready frontend components with accessible markup, sensible props, defined states, and tested behavior.

Frontend component build — Creative Direction skill highlight diagram. Navy header card reads 'Impactful Creative Direction' with the subtitle… (from the rampstackco/claude-skills README)

From the rampstackco/claude-skills README — shows the whole collection, not only this skill. · view on GitHub

How to use it

Claude Code
  1. Run the line below. It pulls the whole folder into ~/.claude/skills/frontend-component-build.
  2. Describe your job in plain words. Claude Code follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit rampstackco/claude-skills/skills/frontend-component-build#main ~/.claude/skills/frontend-component-build

For one project only, change the path to .claude/skills/frontend-component-build.

Claude (web or desktop app)
  1. On this page open ⋯ → Download .md.
  2. Save it as SKILL.md in a folder, zip the folder, then Customize → Skills → + → Create skill → Upload a skill.
  3. Pick the file and Save. Claude shows the name and description and runs a security scan.
  4. Check the skill is switched on.
  5. Start a new chat and describe your job in plain words. The AI follows the skill from there.
ChatGPT or another app
  1. ChatGPT: make a Project and paste it into Instructions.
  2. Neither? Paste it at the top of a new chat — it works for that chat.
Not working?
  • Check which app you pasted it into — the steps above name the right one.
  • Some skills need the paid tier of Claude or ChatGPT.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Source of Frontend component build

Show the full text185 lines
namedescriptioncategorycatalog_summarydisplay_order
frontend-component-buildBuild production-ready frontend components with accessible markup, sensible props, defined states, and tested behavior. Use this skill whenever the user wants to build a component from scratch, refactor an existing one, design a component API, or implement a UI element with proper states and accessibility. Triggers on build a component, create a button, create a modal, create a form input, component API, props design, component states, refactor component, accessible component. Also triggers when implementing UI from a design that needs to be reusable.developmentComponent architecture, props design, accessibility from the start2

Frontend Component Build

Build production-ready components. Stack-agnostic principles. Most patterns translate to React, Vue, Svelte, or vanilla web components.

This skill is about implementing a component well. For broader system design see design-system. For day-to-day visual decisions see design-standards.


When to use

  • Building a new component from scratch
  • Refactoring an existing component
  • Designing a component API (props, slots, events)
  • Adding accessibility to an existing component
  • Implementing a component from a design

When NOT to use

  • Building a full design system (use design-system)
  • Page-level design decisions (use design-standards)
  • Backend or data work (use code-review-web)
  • Performance-only optimization (use performance-optimization)

Required inputs

  • The component's purpose (what UI need it serves)
  • The design (or willingness to design it)
  • The framework or technical context
  • The states the component must support
  • Accessibility requirements

The framework: 6 dimensions

A complete component handles six dimensions. Skip any one and the component is incomplete.

1. Anatomy

Identify the parts that make up the component before writing any markup.

Common anatomies:

  • Button: container + label + (optional) icon + (optional) loading indicator
  • Modal: backdrop + container + header + body + footer + close affordance
  • Form input: label + input + (optional) help text + (optional) error message
  • Card: container + (optional) header + body + (optional) footer + (optional) media

Naming the parts up front makes the API obvious.

2. Variants

What variations does the component support?

  • Visual variants (primary, secondary, ghost, danger)
  • Size variants (small, medium, large)
  • Functional variants (with icon, without icon, icon-only)

Variants should be a managed set, not a free-for-all. Document the supported set; reject requests for new variants without a real use case.

3. States

What states must the component handle?

  • Default
  • Hover (when pointer is supported)
  • Focus (always - keyboard navigation requires it)
  • Active / pressed
  • Disabled
  • Loading (where applicable)
  • Error (for inputs, forms, validation-bound components)
  • Empty (for components that display data)

Every state needs visual treatment AND accessibility treatment.

4. Props / API

Design the component's contract.

API design principles:

  • Required props minimal. What's truly needed every time? That's required. Everything else has a sensible default.
  • Boolean props are red flags. Three booleans means seven combinations. Prefer enum strings: variant: "primary" | "secondary" | "ghost" over primary={true} ghost={false}.
  • Children > props. Where content is content, accept children. Don't invent headerText and bodyText props when slots work.
  • Composition > configuration. A component that does 5 things via 12 props often should be 5 smaller components.
  • Type the props. TypeScript or PropTypes or JSDoc. The type is documentation that won't go out of date.
5. Accessibility

Build it accessible from the start. Adding accessibility later is 5x harder.

Universal:

  • Semantic HTML elements (<button>, <a>, <nav>, <form>, etc.) over generic <div>
  • Keyboard navigable (Tab, Shift+Tab, Enter/Space for buttons)
  • Focus visible
  • Tap targets minimum 44 by 44 pixels
  • ARIA only where semantic HTML is insufficient

Component-specific:

  • Button: use <button>. Don't fake one with a <div>.
  • Modal: focus trap, ESC to close, returns focus to trigger on close, role="dialog" and aria-labelledby.
  • Form input: label associated via for/id or aria-labelledby. Error messages linked via aria-describedby. aria-invalid when in error state.
  • Toggles: <button> with aria-pressed for two-state, or role="switch" for on/off.
  • Tabs: role="tablist" / role="tab" / role="tabpanel" with aria-selected and arrow-key navigation.
  • Tooltips and popovers: triggered by focus AND hover. Dismissible with ESC.
  • Loading states: announce with aria-live so screen readers know something changed.
6. Tests

Verify the component works before declaring it done.

Test types by priority:

  1. Visual regression. Renders correctly across variants and states. (Storybook + visual diff tools, or manual screenshots.)
  2. Accessibility. Passes axe or equivalent automated checks.
  3. Keyboard navigation. Tab, Enter, Escape, arrow keys all work as expected.
  4. Component logic. Props produce expected output. Events fire correctly. (Unit tests.)
  5. Integration. Component works inside its expected parent contexts.

A component without at least automated accessibility testing is not done.


Workflow

  1. Understand the use case. What UI need does this component serve? Where will it appear? Adjacent components?
  2. Sketch the anatomy. Name the parts.
  3. List variants and states. Match the design system or define new ones if needed.
  4. Design the API. Required props, optional props, children, events. Type it.
  5. Build the markup with semantic HTML. Choose the right elements. Avoid generic <div> for interactive things.
  6. Style with tokens. No hardcoded colors, spacing, or sizes.
  7. Add interaction. Focus management, keyboard handlers, ARIA.
  8. Add states. Hover, focus, active, disabled, loading, error.
  9. Test. Automated accessibility, keyboard navigation, visual regression.
  10. Document. Usage, API, examples, anti-patterns.

Failure patterns

  • Building with <div onClick>. Loses keyboard accessibility, screen reader semantics, and focus. Use <button> or <a>.
  • Hardcoding colors and sizes. Tokens exist for a reason. Hardcoded values resist theming and consistency.
  • Boolean prop explosion. <Button primary large rounded fullWidth disabled icon />. Too many booleans means you actually need fewer variants designed more thoughtfully.
  • Forgetting focus states. Hover gets attention; focus gets neglected. Keyboard users see invisible buttons.
  • Skipping disabled-state thought. A disabled button should look obviously disabled AND be aria-disabled AND not respond to clicks.
  • Inventing ARIA. ARIA roles and properties have specific behaviors. Made-up ARIA is worse than no ARIA. Use semantic HTML first.
  • Loading state that doesn't announce. Screen readers don't know the spinner appeared. Use aria-live="polite" or role="status".
  • Tooltip-only critical content. Hover-only content is invisible to keyboard and touch users. Critical content goes in the visible UI.
  • Component without docs. Future-you, your teammate, or the next maintainer cannot use what they cannot understand.

Output format

A complete component delivery includes:

  • Component code (in the appropriate framework)
  • Storybook (or equivalent) entry showing all variants and states
  • Documentation:
    • Anatomy diagram or description
    • Props/API table
    • Usage examples (basic, advanced, edge cases)
    • When to use vs. when to use an alternative
    • Anti-patterns (what to avoid)
    • Accessibility notes
  • Tests (visual regression + accessibility + logic)

Reference files

1---
2name: frontend-component-build
3description: "Build production-ready frontend components with accessible markup, sensible props, defined states, and tested behavior. Use this skill whenever the user wants to build a component from scratch, refactor an existing one, design a component API, or implement a UI element with proper states and accessibility. Triggers on build a component, create a button, create a modal, create a form input, component API, props design, component states, refactor component, accessible component. Also triggers when implementing UI from a design that needs to be reusable."
4category: development
5catalog_summary: "Component architecture, props design, accessibility from the start"
6display_order: 2
7---
8 
9# Frontend Component Build
10 
11Build production-ready components. Stack-agnostic principles. Most patterns translate to React, Vue, Svelte, or vanilla web components.
12 
13This skill is about implementing a component well. For broader system design see `design-system`. For day-to-day visual decisions see `design-standards`.
14 
15---
16 
17## When to use
18 
19- Building a new component from scratch
20- Refactoring an existing component
21- Designing a component API (props, slots, events)
22- Adding accessibility to an existing component
23- Implementing a component from a design
24 
25## When NOT to use
26 
27- Building a full design system (use `design-system`)
28- Page-level design decisions (use `design-standards`)
29- Backend or data work (use `code-review-web`)
30- Performance-only optimization (use `performance-optimization`)
31 
32---
33 
34## Required inputs
35 
36- The component's purpose (what UI need it serves)
37- The design (or willingness to design it)
38- The framework or technical context
39- The states the component must support
40- Accessibility requirements
41 
42---
43 
44## The framework: 6 dimensions
45 
46A complete component handles six dimensions. Skip any one and the component is incomplete.
47 
48### 1. Anatomy
49 
50Identify the parts that make up the component before writing any markup.
51 
52**Common anatomies:**
53- Button: container + label + (optional) icon + (optional) loading indicator
54- Modal: backdrop + container + header + body + footer + close affordance
55- Form input: label + input + (optional) help text + (optional) error message
56- Card: container + (optional) header + body + (optional) footer + (optional) media
57 
58Naming the parts up front makes the API obvious.
59 
60### 2. Variants
61 
62What variations does the component support?
63 
64- **Visual variants** (primary, secondary, ghost, danger)
65- **Size variants** (small, medium, large)
66- **Functional variants** (with icon, without icon, icon-only)
67 
68Variants should be a managed set, not a free-for-all. Document the supported set; reject requests for new variants without a real use case.
69 
70### 3. States
71 
72What states must the component handle?
73 
74- **Default**
75- **Hover** (when pointer is supported)
76- **Focus** (always - keyboard navigation requires it)
77- **Active / pressed**
78- **Disabled**
79- **Loading** (where applicable)
80- **Error** (for inputs, forms, validation-bound components)
81- **Empty** (for components that display data)
82 
83Every state needs visual treatment AND accessibility treatment.
84 
85### 4. Props / API
86 
87Design the component's contract.
88 
89**API design principles:**
90 
91- **Required props minimal.** What's truly needed every time? That's required. Everything else has a sensible default.
92- **Boolean props are red flags.** Three booleans means seven combinations. Prefer enum strings: `variant: "primary" | "secondary" | "ghost"` over `primary={true} ghost={false}`.
93- **Children > props.** Where content is content, accept children. Don't invent `headerText` and `bodyText` props when slots work.
94- **Composition > configuration.** A component that does 5 things via 12 props often should be 5 smaller components.
95- **Type the props.** TypeScript or PropTypes or JSDoc. The type is documentation that won't go out of date.
96 
97### 5. Accessibility
98 
99Build it accessible from the start. Adding accessibility later is 5x harder.
100 
101**Universal:**
102- Semantic HTML elements (`<button>`, `<a>`, `<nav>`, `<form>`, etc.) over generic `<div>`
103- Keyboard navigable (Tab, Shift+Tab, Enter/Space for buttons)
104- Focus visible
105- Tap targets minimum 44 by 44 pixels
106- ARIA only where semantic HTML is insufficient
107 
108**Component-specific:**
109 
110- **Button:** use `<button>`. Don't fake one with a `<div>`.
111- **Modal:** focus trap, ESC to close, returns focus to trigger on close, `role="dialog"` and `aria-labelledby`.
112- **Form input:** label associated via `for`/`id` or `aria-labelledby`. Error messages linked via `aria-describedby`. `aria-invalid` when in error state.
113- **Toggles:** `<button>` with `aria-pressed` for two-state, or `role="switch"` for on/off.
114- **Tabs:** `role="tablist"` / `role="tab"` / `role="tabpanel"` with `aria-selected` and arrow-key navigation.
115- **Tooltips and popovers:** triggered by focus AND hover. Dismissible with ESC.
116- **Loading states:** announce with `aria-live` so screen readers know something changed.
117 
118### 6. Tests
119 
120Verify the component works before declaring it done.
121 
122**Test types by priority:**
123 
1241. **Visual regression.** Renders correctly across variants and states. (Storybook + visual diff tools, or manual screenshots.)
1252. **Accessibility.** Passes axe or equivalent automated checks.
1263. **Keyboard navigation.** Tab, Enter, Escape, arrow keys all work as expected.
1274. **Component logic.** Props produce expected output. Events fire correctly. (Unit tests.)
1285. **Integration.** Component works inside its expected parent contexts.
129 
130A component without at least automated accessibility testing is not done.
131 
132---
133 
134## Workflow
135 
1361. **Understand the use case.** What UI need does this component serve? Where will it appear? Adjacent components?
1372. **Sketch the anatomy.** Name the parts.
1383. **List variants and states.** Match the design system or define new ones if needed.
1394. **Design the API.** Required props, optional props, children, events. Type it.
1405. **Build the markup with semantic HTML.** Choose the right elements. Avoid generic `<div>` for interactive things.
1416. **Style with tokens.** No hardcoded colors, spacing, or sizes.
1427. **Add interaction.** Focus management, keyboard handlers, ARIA.
1438. **Add states.** Hover, focus, active, disabled, loading, error.
1449. **Test.** Automated accessibility, keyboard navigation, visual regression.
14510. **Document.** Usage, API, examples, anti-patterns.
146 
147---
148 
149## Failure patterns
150 
151- **Building with `<div onClick>`.** Loses keyboard accessibility, screen reader semantics, and focus. Use `<button>` or `<a>`.
152- **Hardcoding colors and sizes.** Tokens exist for a reason. Hardcoded values resist theming and consistency.
153- **Boolean prop explosion.** `<Button primary large rounded fullWidth disabled icon />`. Too many booleans means you actually need fewer variants designed more thoughtfully.
154- **Forgetting focus states.** Hover gets attention; focus gets neglected. Keyboard users see invisible buttons.
155- **Skipping disabled-state thought.** A disabled button should look obviously disabled AND be `aria-disabled` AND not respond to clicks.
156- **Inventing ARIA.** ARIA roles and properties have specific behaviors. Made-up ARIA is worse than no ARIA. Use semantic HTML first.
157- **Loading state that doesn't announce.** Screen readers don't know the spinner appeared. Use `aria-live="polite"` or `role="status"`.
158- **Tooltip-only critical content.** Hover-only content is invisible to keyboard and touch users. Critical content goes in the visible UI.
159- **Component without docs.** Future-you, your teammate, or the next maintainer cannot use what they cannot understand.
160 
161---
162 
163## Output format
164 
165A complete component delivery includes:
166 
167- **Component code** (in the appropriate framework)
168- **Storybook (or equivalent) entry** showing all variants and states
169- **Documentation:**
170 - Anatomy diagram or description
171 - Props/API table
172 - Usage examples (basic, advanced, edge cases)
173 - When to use vs. when to use an alternative
174 - Anti-patterns (what to avoid)
175 - Accessibility notes
176- **Tests** (visual regression + accessibility + logic)
177 
178---
179 
180## Reference files
181 
182- [`references/component-spec-template.md`](references/component-spec-template.md) - Template for documenting a component (props, states, accessibility, edge cases) before building.
183- [`references/component-api-patterns.md`](references/component-api-patterns.md) - Common patterns for designing flexible component APIs (compound components, controlled vs uncontrolled, polymorphic `as` prop, render props, slots).
184- [`references/accessibility-patterns.md`](references/accessibility-patterns.md) - ARIA patterns for common interactive components.
185 

Discussion

Alternatives

Also in UI componentsSee all 533 in Development →
shadcn/uiManages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".Coding · MITCreate STYLE_GUIDE.mdThis prompt assists users in creating a comprehensive STYLE_GUIDE.md for their projects. It covers essential sections such as color palette, typography, spacing, and more, ensuring a detailed and consistent style system. Users can also include example component design references.Coding · CC0-1.0Frontend developer skillThis prompt is designed for an elite frontend development specialist. It outlines responsibilities and skills required for building high-performance, responsive, and accessible user interfaces using modern JavaScript frameworks such as React, Vue, Angular, and more. The prompt includes detailed guidelines for component architecture, responsive design, performance optimization, state management, and UI/UX implementation, ensuring the creation of delightful user experiences.Coding · CC0-1.0React modernizationUpgrade React applications to latest versions, migrate from class components to hooks, and adopt concurrent features. Use when modernizing React codebases, migrating to React Hooks, or upgrading to latest React versions.Coding · MIT