@kiva/kv-components 8.3.0 → 8.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +1 -1
- package/CLAUDE.md +4 -4
- package/docs/ai-documentation-prompt.md +306 -0
- package/docs/ai-stories-prompt.md +630 -0
- package/docs/component-documentation-checklist.md +258 -0
- package/docs/component-documentation-guide.md +364 -0
- package/docs/component-stories-checklist.md +326 -0
- package/docs/component-stories-guide.md +765 -0
- package/docs/how-to-use-ai-prompts.md +331 -0
- package/package.json +3 -3
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Component Documentation Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist to ensure comprehensive, high-quality component documentation.
|
|
4
|
+
|
|
5
|
+
## Pre-Documentation
|
|
6
|
+
|
|
7
|
+
- [ ] Component implementation is stable
|
|
8
|
+
- [ ] Component has a corresponding `.stories.js` file with all necessary stories
|
|
9
|
+
- [ ] Component props are well-defined with TypeScript types or PropTypes
|
|
10
|
+
- [ ] Component is tested and working correctly
|
|
11
|
+
- [ ] Design specifications are available (if applicable)
|
|
12
|
+
|
|
13
|
+
## Existing Documentation Assessment (if applicable)
|
|
14
|
+
|
|
15
|
+
- [ ] Existing MDX file reviewed
|
|
16
|
+
- [ ] Existing content quality evaluated
|
|
17
|
+
- [ ] Existing story references inventoried
|
|
18
|
+
- [ ] Missing sections identified
|
|
19
|
+
- [ ] Migration plan created (additive approach)
|
|
20
|
+
- [ ] Existing quality content marked for preservation
|
|
21
|
+
- [ ] Existing story names documented (to preserve references)
|
|
22
|
+
|
|
23
|
+
## Documentation File Setup
|
|
24
|
+
|
|
25
|
+
- [ ] **CRITICAL: Template used** - ComponentDocs.template.mdx structure followed exactly
|
|
26
|
+
- [ ] MDX file created in `src/vue/stories/[ComponentName]Docs.mdx`
|
|
27
|
+
- [ ] Correct imports for Storybook blocks (Canvas, Meta, Story, Controls)
|
|
28
|
+
- [ ] Story file imported correctly (`import * as ComponentStories from './Component.stories.js'`)
|
|
29
|
+
- [ ] Meta tag configured with component name and reference
|
|
30
|
+
- [ ] **No freeform MDX structure** - All template sections present
|
|
31
|
+
|
|
32
|
+
## Content Sections
|
|
33
|
+
|
|
34
|
+
### Header & Overview
|
|
35
|
+
- [ ] Component name as H1
|
|
36
|
+
- [ ] Clear, concise one-sentence description
|
|
37
|
+
- [ ] Component Overview section with description paragraph
|
|
38
|
+
- [ ] ComponentOverview story displayed
|
|
39
|
+
|
|
40
|
+
### Table of Contents
|
|
41
|
+
- [ ] **CRITICAL: Table of Contents present** with all section links
|
|
42
|
+
- [ ] All major sections linked (Variations, Usage Information, Behavior, Anatomy, Specs, Best Practices, Accessibility, Component Properties + Demo, Code Examples)
|
|
43
|
+
- [ ] Links are functional (test by clicking)
|
|
44
|
+
- [ ] Section order matches actual content
|
|
45
|
+
- [ ] Proper markdown anchor link format used
|
|
46
|
+
|
|
47
|
+
### Variations
|
|
48
|
+
- [ ] **CRITICAL: "Variations" heading (not "All Variations")**
|
|
49
|
+
- [ ] Description paragraph explaining available variations
|
|
50
|
+
- [ ] AllVariations story displayed OR multiple focused variation stories used
|
|
51
|
+
- [ ] All size variants documented
|
|
52
|
+
- [ ] All style variants documented
|
|
53
|
+
- [ ] All functional variants documented
|
|
54
|
+
- [ ] For complex components: Multiple smaller variation stories acceptable
|
|
55
|
+
- [ ] Horizontal rule (---) after this section
|
|
56
|
+
|
|
57
|
+
### Usage Information
|
|
58
|
+
- [ ] **CRITICAL: "Usage Information" heading (not "Usage Guidelines")**
|
|
59
|
+
- [ ] Main usage description provided
|
|
60
|
+
- [ ] **"When to Use" subsection** with 3-5 bullet points
|
|
61
|
+
- [ ] **"When Not to Use" subsection** with 3-5 bullet points
|
|
62
|
+
- [ ] Examples are specific and actionable
|
|
63
|
+
- [ ] Guidance considers accessibility and UX
|
|
64
|
+
- [ ] Horizontal rule (---) after this section
|
|
65
|
+
|
|
66
|
+
### Behavior
|
|
67
|
+
- [ ] Overall behavior described
|
|
68
|
+
- [ ] Interactive states documented (hover, active, focus, disabled)
|
|
69
|
+
- [ ] At least 2 behavior subsections
|
|
70
|
+
- [ ] Each subsection has a descriptive title
|
|
71
|
+
- [ ] Each subsection has clear description
|
|
72
|
+
- [ ] Each behavior demonstrated with a story
|
|
73
|
+
- [ ] State transitions explained
|
|
74
|
+
- [ ] User interaction patterns described
|
|
75
|
+
|
|
76
|
+
### Anatomy
|
|
77
|
+
- [ ] **CRITICAL: "Anatomy" heading present**
|
|
78
|
+
- [ ] Brief intro paragraph
|
|
79
|
+
- [ ] Component parts listed with bullet points
|
|
80
|
+
- [ ] Each part clearly described
|
|
81
|
+
- [ ] Props that control each part referenced
|
|
82
|
+
- [ ] Slot usage explained (if applicable)
|
|
83
|
+
- [ ] Horizontal rule (---) after this section
|
|
84
|
+
|
|
85
|
+
### Specs
|
|
86
|
+
- [ ] **CRITICAL: "Specs" heading present**
|
|
87
|
+
- [ ] At least 2 specs subsections
|
|
88
|
+
- [ ] Touch target sizes documented (minimum 44x44px)
|
|
89
|
+
- [ ] Spacing guidelines provided
|
|
90
|
+
- [ ] Typography specs included (if applicable)
|
|
91
|
+
- [ ] Color/theming information (if applicable)
|
|
92
|
+
- [ ] Responsive behavior noted (if applicable)
|
|
93
|
+
- [ ] Visual story demonstrations where helpful
|
|
94
|
+
- [ ] Horizontal rule (---) after this section
|
|
95
|
+
|
|
96
|
+
### Best Practices
|
|
97
|
+
- [ ] **CRITICAL: "Best Practices" heading present**
|
|
98
|
+
- [ ] **CRITICAL: Grid layout with Do/Don't pairs** (not bullet list)
|
|
99
|
+
- [ ] At least 2 do/don't pairs
|
|
100
|
+
- [ ] Grid layout code from template used
|
|
101
|
+
- [ ] Each item has an image placeholder with proper path
|
|
102
|
+
- [ ] Image filenames follow naming convention (KvComponentName/Do-description.png)
|
|
103
|
+
- [ ] Each "Do" has ✓ symbol and green color (#2e7d32)
|
|
104
|
+
- [ ] Each "Don't" has ✗ symbol and red color (#c62828)
|
|
105
|
+
- [ ] Each item has clear, concise description (1-2 sentences)
|
|
106
|
+
- [ ] Practices are actionable and specific
|
|
107
|
+
- [ ] Common mistakes addressed
|
|
108
|
+
- [ ] Horizontal rule (---) after this section
|
|
109
|
+
|
|
110
|
+
### Accessibility
|
|
111
|
+
- [ ] Bullet list format
|
|
112
|
+
- [ ] All ARIA attributes documented
|
|
113
|
+
- [ ] Keyboard navigation support listed
|
|
114
|
+
- [ ] Screen reader behavior described
|
|
115
|
+
- [ ] Focus management explained
|
|
116
|
+
- [ ] Touch target sizes mentioned
|
|
117
|
+
- [ ] Disabled state handling noted
|
|
118
|
+
- [ ] Color contrast requirements (if applicable)
|
|
119
|
+
|
|
120
|
+
### Component Properties + Demo
|
|
121
|
+
- [ ] **CRITICAL: "Component Properties + Demo" heading (not "Interactive Playground")**
|
|
122
|
+
- [ ] Canvas component displayed with Default story
|
|
123
|
+
- [ ] Controls component displayed with Default story
|
|
124
|
+
- [ ] Default story shows typical usage
|
|
125
|
+
- [ ] All props visible in controls
|
|
126
|
+
- [ ] Horizontal rule (---) after this section
|
|
127
|
+
|
|
128
|
+
### Code Examples
|
|
129
|
+
- [ ] **CRITICAL: "Code Examples" heading present**
|
|
130
|
+
- [ ] **CRITICAL: At least 3 code examples** (not inline examples scattered throughout)
|
|
131
|
+
- [ ] Examples progress from simple to complex
|
|
132
|
+
- [ ] Each example has a descriptive ### heading
|
|
133
|
+
- [ ] Code is syntactically correct
|
|
134
|
+
- [ ] Code uses realistic prop values
|
|
135
|
+
- [ ] Code follows Vue best practices
|
|
136
|
+
- [ ] Examples cover common use cases
|
|
137
|
+
- [ ] Examples are copy-paste ready
|
|
138
|
+
- [ ] Vue code blocks specified with ```vue
|
|
139
|
+
- [ ] No horizontal rule after this section (end of document)
|
|
140
|
+
|
|
141
|
+
## Technical Quality
|
|
142
|
+
|
|
143
|
+
- [ ] All story references are valid
|
|
144
|
+
- [ ] No broken links
|
|
145
|
+
- [ ] No template placeholders remaining (`{{` syntax)
|
|
146
|
+
- [ ] MDX syntax is valid (no errors in Storybook)
|
|
147
|
+
- [ ] Images display correctly (or placeholders noted)
|
|
148
|
+
- [ ] Code blocks have correct language specified
|
|
149
|
+
|
|
150
|
+
## Content Quality
|
|
151
|
+
|
|
152
|
+
- [ ] Writing is clear and concise
|
|
153
|
+
- [ ] Terminology is consistent throughout
|
|
154
|
+
- [ ] Grammar and spelling are correct
|
|
155
|
+
- [ ] Tone matches existing documentation
|
|
156
|
+
- [ ] Technical accuracy verified
|
|
157
|
+
- [ ] No assumptions about user knowledge
|
|
158
|
+
- [ ] Jargon is explained or avoided
|
|
159
|
+
|
|
160
|
+
## Visual Assets
|
|
161
|
+
|
|
162
|
+
- [ ] Image folder created in `public/[ComponentName]/`
|
|
163
|
+
- [ ] All referenced images exist or are documented as needed
|
|
164
|
+
- [ ] Images use descriptive kebab-case filenames
|
|
165
|
+
- [ ] Images are optimized for web
|
|
166
|
+
- [ ] Alt text provided (or marked decorative)
|
|
167
|
+
|
|
168
|
+
## Storybook Stories
|
|
169
|
+
|
|
170
|
+
Verify these stories exist in the `.stories.js` file:
|
|
171
|
+
- [ ] Component (export)
|
|
172
|
+
- [ ] ComponentOverview
|
|
173
|
+
- [ ] AllVariations
|
|
174
|
+
- [ ] Default
|
|
175
|
+
- [ ] Behavior demonstration stories (as referenced)
|
|
176
|
+
- [ ] Specs demonstration stories (as referenced)
|
|
177
|
+
- [ ] Additional stories as needed
|
|
178
|
+
|
|
179
|
+
## Cross-Reference Checks
|
|
180
|
+
|
|
181
|
+
- [ ] Component name matches across all files
|
|
182
|
+
- [ ] Prop names match component implementation
|
|
183
|
+
- [ ] Story names match between docs and stories file
|
|
184
|
+
- [ ] Code examples use correct prop names
|
|
185
|
+
- [ ] Accessibility features match implementation
|
|
186
|
+
|
|
187
|
+
## Testing
|
|
188
|
+
|
|
189
|
+
- [ ] View documentation in Storybook
|
|
190
|
+
- [ ] Verify all stories render correctly
|
|
191
|
+
- [ ] Test all interactive controls
|
|
192
|
+
- [ ] Click all TOC links
|
|
193
|
+
- [ ] Verify code examples in actual implementation
|
|
194
|
+
- [ ] Check responsive layout of Best Practices grid
|
|
195
|
+
- [ ] Test with screen reader (if possible)
|
|
196
|
+
|
|
197
|
+
## Final Review
|
|
198
|
+
|
|
199
|
+
- [ ] Compare to reference documentation (KvIconButtonDocs.mdx)
|
|
200
|
+
- [ ] Verify completeness against this checklist
|
|
201
|
+
- [ ] Get peer review (if available)
|
|
202
|
+
- [ ] Address all feedback
|
|
203
|
+
- [ ] Run final read-through for clarity
|
|
204
|
+
|
|
205
|
+
## Post-Documentation
|
|
206
|
+
|
|
207
|
+
- [ ] Update component AGENTS.md if needed
|
|
208
|
+
- [ ] Add any new patterns to documentation guide
|
|
209
|
+
- [ ] Note any template improvements needed
|
|
210
|
+
- [ ] Document any component-specific quirks for future reference
|
|
211
|
+
|
|
212
|
+
## Common Issues to Watch For
|
|
213
|
+
|
|
214
|
+
- [ ] ⚠️ **Template not followed - freeform MDX structure created**
|
|
215
|
+
- [ ] ⚠️ **Missing Table of Contents**
|
|
216
|
+
- [ ] ⚠️ **Wrong section headings** (e.g., "All Variations" instead of "Variations")
|
|
217
|
+
- [ ] ⚠️ **Best Practices as bullet list** instead of Do/Don't grid layout
|
|
218
|
+
- [ ] ⚠️ **Code examples inline** instead of in dedicated "Code Examples" section
|
|
219
|
+
- [ ] ⚠️ **Missing required sections** (Anatomy, Specs, Usage Information, etc.)
|
|
220
|
+
- [ ] ⚠️ **Missing horizontal rules** (---) between major sections
|
|
221
|
+
- [ ] ⚠️ Story name typos (story reference doesn't match actual story)
|
|
222
|
+
- [ ] ⚠️ Incorrect prop names in code examples
|
|
223
|
+
- [ ] ⚠️ Missing accessibility documentation
|
|
224
|
+
- [ ] ⚠️ Vague or generic usage guidance
|
|
225
|
+
- [ ] ⚠️ Code examples that don't work
|
|
226
|
+
- [ ] ⚠️ Broken image links
|
|
227
|
+
- [ ] ⚠️ Missing behavior subsections for complex components
|
|
228
|
+
- [ ] ⚠️ Specs section without actual specifications
|
|
229
|
+
- [ ] ⚠️ Template placeholders not replaced ({{}})
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Quick Reference: Minimum Requirements
|
|
234
|
+
|
|
235
|
+
Every component documentation MUST have:
|
|
236
|
+
1. ✅ **Follow ComponentDocs.template.mdx structure exactly**
|
|
237
|
+
2. ✅ **Table of Contents with all section links**
|
|
238
|
+
3. ✅ Clear description and overview
|
|
239
|
+
4. ✅ **Variations section** (not "All Variations")
|
|
240
|
+
5. ✅ **Usage Information** with When to Use / When Not to Use lists
|
|
241
|
+
6. ✅ **Behavior section** with at least 2 behavior examples with stories
|
|
242
|
+
7. ✅ **Anatomy section** with component parts breakdown
|
|
243
|
+
8. ✅ **Specs section** with at least 2 specifications
|
|
244
|
+
9. ✅ **Best Practices section** with at least 2 Do/Don't pairs in grid layout
|
|
245
|
+
10. ✅ Complete accessibility documentation
|
|
246
|
+
11. ✅ **Component Properties + Demo** section with Canvas and Controls
|
|
247
|
+
12. ✅ **Code Examples section** with at least 3 working examples
|
|
248
|
+
13. ✅ Horizontal rules (---) between all major sections
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
**Documentation Status:** [Draft | In Review | Complete]
|
|
253
|
+
|
|
254
|
+
**Reviewed By:** _______________
|
|
255
|
+
|
|
256
|
+
**Date:** _______________
|
|
257
|
+
|
|
258
|
+
**Notes:**
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# Component Documentation Guide
|
|
2
|
+
|
|
3
|
+
This guide outlines the standards and best practices for creating comprehensive component documentation in the kv-components library.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ⚠️ CRITICAL: ALWAYS Use the ComponentDocs.template.mdx Template
|
|
8
|
+
|
|
9
|
+
**When creating any component `.mdx` documentation file, you MUST use the template:**
|
|
10
|
+
|
|
11
|
+
📄 **Template Location:** `@kiva/kv-components/src/vue/.storybook/templates/ComponentDocs.template.mdx`
|
|
12
|
+
|
|
13
|
+
**This is NOT optional. Do NOT create freeform MDX documentation.**
|
|
14
|
+
|
|
15
|
+
The template ensures:
|
|
16
|
+
- Consistent structure across all component documentation
|
|
17
|
+
- All required sections are included
|
|
18
|
+
- Proper Storybook configuration and imports
|
|
19
|
+
- Standardized layout and formatting
|
|
20
|
+
- Accessibility and best practices coverage
|
|
21
|
+
|
|
22
|
+
**Process:**
|
|
23
|
+
1. Copy the ComponentDocs.template.mdx file
|
|
24
|
+
2. Fill in ALL `{{placeholders}}` with component-specific content
|
|
25
|
+
3. Follow the exact section structure (do not skip or reorder sections)
|
|
26
|
+
4. Reference actual stories from the component's .stories.js file
|
|
27
|
+
5. Add component-specific subsections as needed within the template structure
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Creation Order
|
|
32
|
+
|
|
33
|
+
Documentation can be created before or after stories:
|
|
34
|
+
|
|
35
|
+
### After Stories (Recommended)
|
|
36
|
+
- Stories already exist and work
|
|
37
|
+
- Documentation references real, tested stories
|
|
38
|
+
- Can screenshot actual story examples
|
|
39
|
+
- Less refactoring needed
|
|
40
|
+
|
|
41
|
+
### Before Stories
|
|
42
|
+
- Documentation drives story requirements
|
|
43
|
+
- Clear specifications for story implementation
|
|
44
|
+
- Better for complex components
|
|
45
|
+
- Stories built to match documented behaviors
|
|
46
|
+
|
|
47
|
+
**Either approach works** - choose based on your workflow and component complexity.
|
|
48
|
+
|
|
49
|
+
## Handling Missing Stories
|
|
50
|
+
|
|
51
|
+
If creating documentation before stories exist, create a **stub** `.stories.js` file first so the MDX import resolves.
|
|
52
|
+
|
|
53
|
+
```mdx
|
|
54
|
+
<!--
|
|
55
|
+
TODO: Create these stories in KvComponent.stories.js:
|
|
56
|
+
- ComponentOverview: Show main variants (bare, styled, interactive)
|
|
57
|
+
- AllVariations: Comprehensive showcase of all options
|
|
58
|
+
- Default: Interactive playground
|
|
59
|
+
- ComponentStates: Enabled, disabled, loading, error states
|
|
60
|
+
- SpecialBehavior: [Describe what this should demonstrate]
|
|
61
|
+
|
|
62
|
+
See component-stories-guide.md for implementation details.
|
|
63
|
+
-->
|
|
64
|
+
|
|
65
|
+
import { Canvas, Meta, Story, Controls } from '@storybook/addon-docs/blocks';
|
|
66
|
+
import * as KvComponentStories from './KvComponent.stories.js';
|
|
67
|
+
|
|
68
|
+
<Meta title="KvComponent" component={KvComponentStories.Component} />
|
|
69
|
+
|
|
70
|
+
## Component Overview
|
|
71
|
+
|
|
72
|
+
<Story of={KvComponentStories.ComponentOverview} />
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The MDX import requires a real stories file. Use a stub with matching export names (ComponentOverview, AllVariations,
|
|
76
|
+
Default, etc.) so Storybook can load while you flesh out the stories.
|
|
77
|
+
|
|
78
|
+
## Documentation Structure
|
|
79
|
+
|
|
80
|
+
Every component should have a corresponding `.mdx` documentation file in `src/vue/stories/` that follows this structure:
|
|
81
|
+
|
|
82
|
+
### 1. Component Header
|
|
83
|
+
- Component name as H1
|
|
84
|
+
- Brief one-sentence description of the component's purpose
|
|
85
|
+
- Component Overview section with visual examples
|
|
86
|
+
|
|
87
|
+
### 2. Table of Contents
|
|
88
|
+
Include links to all major sections:
|
|
89
|
+
- Variations
|
|
90
|
+
- Usage Information
|
|
91
|
+
- Behavior
|
|
92
|
+
- Anatomy
|
|
93
|
+
- Specs
|
|
94
|
+
- Best Practices
|
|
95
|
+
- Accessibility
|
|
96
|
+
- Component Properties + Demo
|
|
97
|
+
- Code Examples
|
|
98
|
+
|
|
99
|
+
### 3. Variations
|
|
100
|
+
Show all visual and functional variants of the component. This helps users understand the full range of options available.
|
|
101
|
+
|
|
102
|
+
**What to include:**
|
|
103
|
+
- Size variations (if applicable)
|
|
104
|
+
- Style variants (outline, filled, ghost, etc.)
|
|
105
|
+
- State variations (default, hover, active, disabled)
|
|
106
|
+
- Functional variants (default vs. toggle, single vs. multiple selection, etc.)
|
|
107
|
+
|
|
108
|
+
### 4. Usage Information
|
|
109
|
+
Provide clear guidance on when and how to use the component.
|
|
110
|
+
|
|
111
|
+
**Required subsections:**
|
|
112
|
+
- **When to Use**: Bullet list of appropriate use cases
|
|
113
|
+
- **When Not to Use**: Bullet list of scenarios where this component is not suitable
|
|
114
|
+
|
|
115
|
+
**Tips:**
|
|
116
|
+
- Be specific and actionable
|
|
117
|
+
- Reference common patterns in web applications
|
|
118
|
+
- Consider accessibility and user experience implications
|
|
119
|
+
|
|
120
|
+
### 5. Behavior
|
|
121
|
+
Explain how the component behaves and responds to user interaction.
|
|
122
|
+
|
|
123
|
+
**What to cover:**
|
|
124
|
+
- Interactive states (hover, active, focus, disabled)
|
|
125
|
+
- State transitions and animations
|
|
126
|
+
- User interaction patterns
|
|
127
|
+
- Special behaviors (toggles, selections, expansions, etc.)
|
|
128
|
+
- Any component-specific interaction rules
|
|
129
|
+
|
|
130
|
+
**Include:**
|
|
131
|
+
- Visual story demonstrations for each behavior
|
|
132
|
+
- Clear descriptions of state changes
|
|
133
|
+
- When state updates occur (immediately, on blur, etc.)
|
|
134
|
+
|
|
135
|
+
### 6. Anatomy
|
|
136
|
+
Break down the component's structure into its constituent parts.
|
|
137
|
+
|
|
138
|
+
**Format:**
|
|
139
|
+
- Brief intro paragraph
|
|
140
|
+
- Bullet list of component parts with descriptions
|
|
141
|
+
- Reference to relevant props that control each part
|
|
142
|
+
|
|
143
|
+
**Example:**
|
|
144
|
+
```markdown
|
|
145
|
+
The button consists of three main parts:
|
|
146
|
+
- **Label**: The text content (controlled via default slot)
|
|
147
|
+
- **Icon** (optional): Visual indicator (via `icon` prop)
|
|
148
|
+
- **Container**: Background and border styling (via variant props)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 7. Specs
|
|
152
|
+
Document technical specifications and measurements.
|
|
153
|
+
|
|
154
|
+
**Common specs to include:**
|
|
155
|
+
- Touch target sizes (minimum 44x44px for accessibility)
|
|
156
|
+
- Spacing guidelines (internal padding, external margins)
|
|
157
|
+
- Typography specifications (font sizes, weights, line heights)
|
|
158
|
+
- Color specifications (reference design tokens)
|
|
159
|
+
- Border radius values
|
|
160
|
+
- Any responsive behavior
|
|
161
|
+
|
|
162
|
+
**Include:**
|
|
163
|
+
- Visual demonstrations when helpful
|
|
164
|
+
- Specific pixel/rem values
|
|
165
|
+
- References to design tokens
|
|
166
|
+
|
|
167
|
+
### 8. Best Practices
|
|
168
|
+
Provide do's and don'ts with visual examples.
|
|
169
|
+
|
|
170
|
+
**⚠️ IMPORTANT: Images vs. Text Format**
|
|
171
|
+
|
|
172
|
+
**If you have images ready:**
|
|
173
|
+
- Use a 2-column grid layout with images
|
|
174
|
+
- Each item includes an image, label (✓ Do or ✗ Don't), and description
|
|
175
|
+
- Follow the image naming convention below
|
|
176
|
+
- Aim for 2-4 pairs of do's and don'ts
|
|
177
|
+
|
|
178
|
+
**If you don't have images:**
|
|
179
|
+
- Use text-based format with clear headings and bullet points
|
|
180
|
+
- Format: `✓ [Guideline]` and `✗ [Anti-pattern]`
|
|
181
|
+
- **DO NOT leave empty image placeholders** - remove the grid layout entirely
|
|
182
|
+
- Images can be added later when available
|
|
183
|
+
|
|
184
|
+
**Example text-based format (when images aren't ready):**
|
|
185
|
+
```markdown
|
|
186
|
+
## Best Practices
|
|
187
|
+
|
|
188
|
+
**Shadow Depth:**
|
|
189
|
+
- ✓ Use appropriate shadow depth to indicate content importance
|
|
190
|
+
- ✗ Don't use excessive shadow depth for standard content
|
|
191
|
+
|
|
192
|
+
**Spacing:**
|
|
193
|
+
- ✓ Add padding to card content for proper spacing
|
|
194
|
+
- ✗ Don't forget padding - the component doesn't include internal padding
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Image naming convention (when using images):**
|
|
198
|
+
```
|
|
199
|
+
ComponentName/Do-brief-description.png
|
|
200
|
+
ComponentName/Do-not-brief-description.png
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Tips:**
|
|
204
|
+
- Use actual component screenshots or mockups
|
|
205
|
+
- Focus on common mistakes or misunderstandings
|
|
206
|
+
- Cover both visual and functional best practices
|
|
207
|
+
- Keep descriptions concise (1-2 sentences)
|
|
208
|
+
|
|
209
|
+
### 9. Accessibility
|
|
210
|
+
List all accessibility features and requirements.
|
|
211
|
+
|
|
212
|
+
**Format:** Bullet list
|
|
213
|
+
|
|
214
|
+
**What to include:**
|
|
215
|
+
- Required ARIA attributes (`aria-label`, `aria-labelledby`, `aria-pressed`, etc.)
|
|
216
|
+
- Keyboard navigation support (Enter, Space, Arrow keys, etc.)
|
|
217
|
+
- Screen reader announcements
|
|
218
|
+
- Focus management
|
|
219
|
+
- Minimum touch target sizes
|
|
220
|
+
- Color contrast requirements
|
|
221
|
+
- Disabled state communication
|
|
222
|
+
|
|
223
|
+
### 10. Component Properties + Demo
|
|
224
|
+
Display the interactive controls for component props.
|
|
225
|
+
|
|
226
|
+
**Required elements:**
|
|
227
|
+
```mdx
|
|
228
|
+
<Canvas of={ComponentStories.Default} />
|
|
229
|
+
<Controls of={ComponentStories.Default} />
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
This automatically generates:
|
|
233
|
+
- Live component preview
|
|
234
|
+
- Interactive controls for all props
|
|
235
|
+
- Prop documentation table
|
|
236
|
+
|
|
237
|
+
### 11. Code Examples
|
|
238
|
+
Provide practical, copy-paste ready code examples.
|
|
239
|
+
|
|
240
|
+
**Guidelines:**
|
|
241
|
+
- Include 2-5 examples showing common use cases
|
|
242
|
+
- Start with the simplest example
|
|
243
|
+
- Progress to more complex scenarios
|
|
244
|
+
- Use actual prop names and realistic values
|
|
245
|
+
- Include necessary imports if non-obvious
|
|
246
|
+
|
|
247
|
+
**Example titles:**
|
|
248
|
+
- "Basic [Component]"
|
|
249
|
+
- "[Component] with [Feature]"
|
|
250
|
+
- "[Component] with [Variant]"
|
|
251
|
+
- "Complex [Component] Example"
|
|
252
|
+
|
|
253
|
+
## Writing Style
|
|
254
|
+
|
|
255
|
+
### Voice and Tone
|
|
256
|
+
- **Clear and Direct**: Use simple, straightforward language
|
|
257
|
+
- **Action-Oriented**: Start with verbs when describing usage
|
|
258
|
+
- **Consistent**: Use the same terminology throughout
|
|
259
|
+
- **Helpful**: Anticipate questions and provide answers
|
|
260
|
+
|
|
261
|
+
### Grammar and Formatting
|
|
262
|
+
- Use sentence case for headings
|
|
263
|
+
- Use complete sentences in descriptions
|
|
264
|
+
- Use bullet points for lists
|
|
265
|
+
- Use bold for emphasis on key terms or component parts
|
|
266
|
+
- Use code formatting for prop names, values, and code snippets
|
|
267
|
+
|
|
268
|
+
### Terminology
|
|
269
|
+
- Use consistent names for component parts throughout
|
|
270
|
+
- Define any domain-specific terms on first use
|
|
271
|
+
- Use Kiva-specific terminology when applicable
|
|
272
|
+
|
|
273
|
+
## Images and Visual Assets
|
|
274
|
+
|
|
275
|
+
### Image Requirements
|
|
276
|
+
- Store images in `public/[ComponentName]/` directory
|
|
277
|
+
- Use descriptive, kebab-case filenames
|
|
278
|
+
- Include alt text (can be empty for decorative images)
|
|
279
|
+
- Optimize images for web (use appropriate compression)
|
|
280
|
+
|
|
281
|
+
### Image Naming Convention
|
|
282
|
+
```
|
|
283
|
+
ComponentName/Do-descriptive-action.png
|
|
284
|
+
ComponentName/Do-not-descriptive-action.png
|
|
285
|
+
ComponentName/[descriptive-feature-name].png
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Storybook Integration
|
|
289
|
+
|
|
290
|
+
### Required Stories
|
|
291
|
+
Every component documentation should reference these Storybook stories:
|
|
292
|
+
1. **Component** - The component export
|
|
293
|
+
2. **ComponentOverview** - Initial visual overview
|
|
294
|
+
3. **AllVariations** - Comprehensive variation showcase
|
|
295
|
+
4. **Default** - Default/standard configuration
|
|
296
|
+
5. Additional stories as needed for behaviors, states, and specs
|
|
297
|
+
|
|
298
|
+
### Story Naming
|
|
299
|
+
- Use PascalCase for story names
|
|
300
|
+
- Be descriptive and specific
|
|
301
|
+
- Match the section where the story appears in docs
|
|
302
|
+
|
|
303
|
+
## Quality Checklist
|
|
304
|
+
|
|
305
|
+
**Use the comprehensive checklist to verify your documentation:**
|
|
306
|
+
📋 [Component Documentation Checklist](./component-documentation-checklist.md)
|
|
307
|
+
|
|
308
|
+
**Quick verification - before considering documentation complete, verify:**
|
|
309
|
+
|
|
310
|
+
- [ ] All sections from the template are present
|
|
311
|
+
- [ ] Component description is clear and accurate
|
|
312
|
+
- [ ] Usage Information includes both "When to Use" and "When Not to Use"
|
|
313
|
+
- [ ] Behavior section covers all interactive states
|
|
314
|
+
- [ ] Anatomy clearly identifies all component parts
|
|
315
|
+
- [ ] Specs include relevant measurements and values
|
|
316
|
+
- [ ] Best Practices has at least 2 do/don't pairs with images
|
|
317
|
+
- [ ] Accessibility lists all relevant features and requirements
|
|
318
|
+
- [ ] Code examples are tested and functional
|
|
319
|
+
- [ ] All Storybook story references work correctly
|
|
320
|
+
- [ ] Images are properly formatted and display correctly
|
|
321
|
+
- [ ] Links in Table of Contents work
|
|
322
|
+
- [ ] Grammar and spelling are correct
|
|
323
|
+
|
|
324
|
+
## Working with Existing Documentation
|
|
325
|
+
|
|
326
|
+
When updating or migrating existing documentation:
|
|
327
|
+
|
|
328
|
+
### Assessment
|
|
329
|
+
1. **Review existing content** - Identify what's already well-documented
|
|
330
|
+
2. **Compare to template** - Note missing sections vs. template
|
|
331
|
+
3. **Evaluate story references** - Check which stories exist and work well
|
|
332
|
+
4. **Preserve quality content** - Don't rewrite for the sake of it
|
|
333
|
+
|
|
334
|
+
### Migration Strategy
|
|
335
|
+
1. **Additive approach** - Add missing sections rather than replacing everything
|
|
336
|
+
2. **Preserve story references** - Keep existing story names that work
|
|
337
|
+
3. **Enhance incrementally** - Improve section by section
|
|
338
|
+
4. **Maintain continuity** - Don't break existing references or examples
|
|
339
|
+
|
|
340
|
+
### Story Reference Flexibility
|
|
341
|
+
- **ComponentOverview**: Can use existing stories if they showcase key variants
|
|
342
|
+
- **AllVariations**: For complex components, multiple smaller stories are acceptable
|
|
343
|
+
- Not every component needs one comprehensive AllVariations story
|
|
344
|
+
- Can reference multiple existing variation stories instead
|
|
345
|
+
- Example: "See [Size Variations](#size-variations), [Style Variants](#style-variants), and [State Examples](#state-examples)"
|
|
346
|
+
- **Default**: Should always exist - enhance existing one rather than creating new
|
|
347
|
+
|
|
348
|
+
## Maintenance
|
|
349
|
+
|
|
350
|
+
Documentation should be updated when:
|
|
351
|
+
- Component API changes (new props, removed props, changed defaults)
|
|
352
|
+
- Visual design updates
|
|
353
|
+
- New variants or behaviors are added
|
|
354
|
+
- Accessibility features are enhanced
|
|
355
|
+
- Common questions or issues arise that should be documented
|
|
356
|
+
- Best practices evolve
|
|
357
|
+
- Migrating to current template standards
|
|
358
|
+
|
|
359
|
+
## Resources
|
|
360
|
+
|
|
361
|
+
- [Storybook MDX Documentation](https://storybook.js.org/docs/writing-docs/mdx)
|
|
362
|
+
- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
|
|
363
|
+
- [WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
|
|
364
|
+
- Reference: [KvIconButtonDocs.mdx](../src/vue/stories/KvIconButtonDocs.mdx)
|