name: 'step-08b-create-new-component' description: 'Add a new component to the design system with full specification'
Add a new component to the design system: generate ID, determine category, extract attributes, create component file from template, update index and stats.
{communication_language}Generate unique component ID:
Type Prefixes:
Button → btn
Input Field → inp
Card → crd
Modal → mdl
Dropdown → drp
Checkbox → chk
Radio → rad
Toggle → tgl
Tab → tab
Accordion → acc
Alert → alt
Badge → bdg
Avatar → avt
Icon → icn
Image → img
Link → lnk
Text → txt
Heading → hdg
List → lst
Table → tbl
Form → frm
Container → cnt
Grid → grd
Flex → flx
Divider → div
Spacer → spc
Example:
Component Type: Button
Existing Button IDs: btn-001, btn-002
New ID: btn-003
```
🆔 Generated Component ID: btn-003
```
Categorize component for organization:
Example:
Component: Button
Category: Interactive
From complete specification, extract component-level info:
Visual Attributes:
Behavioral Attributes:
Functional Attributes:
Design System Attributes:
Use component template to create file:
File: D-Design-System/components/[component-name].md
Template Structure:
# [Component Name] [component-id]
**Type:** [Interactive/Form/Layout/Content/Feedback/Navigation]
**Category:** [Specific category]
**Purpose:** [Brief description]
---
## Overview
[Component description and when to use it]
---
## Variants
[If component has variants, list them]
**Example:**
- primary - Main call-to-action
- secondary - Secondary actions
- ghost - Subtle actions
[If no variants:]
This component has no variants.
---
## States
**Required States:**
- default
- hover
- active
- disabled
**Optional States:**
- loading
- error
- success
- focus
**State Descriptions:**
[Describe what each state looks like/does]
---
## Styling
### Visual Properties
**Size:** [small/medium/large or specific values]
**Shape:** [rounded/square/pill or specific border-radius]
**Colors:** [Color tokens or values]
**Typography:** [Font tokens or values]
**Spacing:** [Padding/margin values]
### Design Tokens
[If using design tokens:]
```yaml
colors:
background: primary-500
text: white
border: primary-600
typography:
font-size: text-base
font-weight: semibold
spacing:
padding-x: 4
padding-y: 2
effects:
border-radius: md
shadow: sm
```
[If Mode B - Custom Design System:] Figma Component: [Link to Figma component] Node ID: [Figma node ID] Last Synced: [Date]
[If Mode C - Component Library:] Library: [shadcn/Radix/etc.] Component: [Library component name] Customizations: [Any overrides from library default]
Click: [What happens on click]
Hover: [What happens on hover]
Focus: [What happens on focus]
Keyboard: [Keyboard shortcuts/navigation]
[If component has animations:]
ARIA Attributes:
Keyboard Support:
Screen Reader: [How screen readers should announce this component]
[Guidelines for when this component is appropriate]
[Guidelines for when to use a different component]
Pages: [List of pages using this component]
Usage Count: [Number]
Examples:
[If this component is related to others:]
Created: [Date] Last Updated: [Date]
Changes:
[Any additional notes, considerations, or future plans]
---
## Step 5: Populate Template
<action>
Fill template with extracted information:
</action>
**Example Output:**
```markdown
# Button [btn-003]
**Type:** Interactive
**Category:** Action
**Purpose:** Trigger primary and secondary actions
---
## Overview
Buttons are used to trigger actions. They should have clear, action-oriented labels that describe what will happen when clicked.
Use buttons for important actions that change state or navigate to new content.
---
## Variants
- **primary** - Main call-to-action (submit, save, continue)
- **secondary** - Secondary actions (cancel, back)
- **ghost** - Subtle actions (close, dismiss)
---
## States
**Required States:**
- default - Normal state
- hover - Mouse over button
- active - Button being clicked
- disabled - Button cannot be clicked
**Optional States:**
- loading - Action in progress (shows spinner)
**State Descriptions:**
**Default:** Blue background, white text, medium size
**Hover:** Darker blue background, slight scale increase
**Active:** Even darker blue, slight scale decrease
**Disabled:** Gray background, gray text, reduced opacity
**Loading:** Disabled state + spinner icon
---
## Styling
### Visual Properties
**Size:** medium (h-10, px-4)
**Shape:** rounded (border-radius: 0.375rem)
**Colors:**
- Background: blue-600
- Text: white
- Border: none
**Typography:**
- Font size: 14px
- Font weight: 600
- Line height: 1.5
**Spacing:**
- Padding X: 16px
- Padding Y: 8px
- Gap (if icon): 8px
### Design Tokens
```yaml
colors:
primary:
background: blue-600
hover: blue-700
active: blue-800
text: white
typography:
size: text-sm
weight: semibold
spacing:
padding-x: 4
padding-y: 2
gap: 2
effects:
border-radius: md
shadow: sm
transition: all 150ms ease
Library: shadcn/ui Component: Button Customizations: None (using library defaults)
Click: Triggers associated action (form submit, navigation, etc.)
Hover:
Focus:
Keyboard:
Hover Scale:
Click Feedback:
ARIA Attributes:
Keyboard Support:
Screen Reader: Announces button label and state (disabled, busy, etc.)
Pages: 1
Usage Count: 1
Examples:
Created: 2024-12-09 Last Updated: 2024-12-09
Changes:
This is the primary button component. Consider adding more variants as needs emerge (danger, success, etc.).
---
## Step 6: Update Component Index
<action>
Add component to index:
</action>
**Update:** `D-Design-System/components/README.md`
```markdown
## Component List
### Interactive Components
- Button [btn-001] - Primary action buttons
- Icon Button [btn-002] - Icon-only actions
- Button [btn-003] - Standard action button ← Added
**Total Interactive:** 3
Update design system statistics:
Update: D-Design-System/README.md (if exists)
**Total Components:** 4 (was 3)
**Last Updated:** [Date]
**Latest Addition:** Button [btn-003]
Generate reference for page spec:
Output:
component_reference:
id: btn-003
name: Button
variant: primary
file: D-Design-System/components/button.md
Validate component creation:
If ID conflict:
⚠️ Component ID btn-003 already exists.
Generating alternative ID: btn-004
If file creation fails:
❌ Error creating component file.
Error: [error message]
Would you like to:
1. Retry
2. Create with different ID
3. Skip design system for this component
Your choice:
If template population incomplete:
⚠️ Some component information is missing.
Missing:
- [List of missing fields]
I'll create the component with placeholders.
You can fill in details later.
This operation creates a new component. Return to Phase 4 with component reference. ```
Display: "Select an Option: [C] Continue or [M] Return to Activity Menu"
ONLY WHEN [component is created with full specification, index updated, and reference generated], will you then load and read fully {nextStepFile} to execute the next step.
Master Rule: Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.