Skip to content

Commit 07bab46

Browse files
committed
chore: update Item documentation
1 parent a0d3a21 commit 07bab46

File tree

2 files changed

+56
-92
lines changed

2 files changed

+56
-92
lines changed

.cursor/rules/documentation.mdc

Lines changed: 44 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,15 @@ alwaysApply: false
44
---
55
# Component Documentation Guidelines
66

7-
This guide outlines the standards and structure for documenting components in the Cube UI Kit. Following these guidelines ensures consistency, clarity, and comprehensive coverage of component features.
8-
9-
## Overview
10-
11-
Our component documentation serves multiple purposes:
12-
- Provides clear usage instructions for developers
13-
- Ensures accessibility best practices are communicated
14-
- Documents styling capabilities through the `tasty` style system
15-
- Maintains consistency across all component documentation
16-
177
## Key Principles
188

19-
1. **Accessibility First**: Components use React Aria Hooks and documentation should emphasize accessibility features
20-
2. **Style System Integration**: Document `tasty` styling capabilities thoroughly
21-
3. **Practical Examples**: Include real-world usage examples, not just API references
22-
4. **Clear Structure**: Follow the prescribed documentation structure for consistency
9+
1. **Accessibility First**: Document React Aria features and keyboard/screen reader support
10+
2. **Style System**: Document `tasty` styling capabilities (sub-elements, modifiers, style props)
11+
3. **Code Examples Required**: **CRITICAL - Stories alone are NOT code examples. Always include actual JSX code snippets showing usage.**
12+
4. **Clear Structure**: Follow the prescribed structure below
2313

2414
## Documentation Structure
2515

26-
Every component documentation file should follow this structure:
27-
2816
```mdx
2917
import { Meta, Canvas, Story, Controls } from '@storybook/addon-docs/blocks';
3018
import { ComponentName } from './ComponentName';
@@ -104,6 +92,8 @@ The `mods` property accepts the following modifiers you can override:
10492

10593
## Examples
10694

95+
**IMPORTANT: Stories are for interactive demos. You MUST also provide JSX code snippets in this section.**
96+
10797
### Basic Usage
10898

10999
```jsx
@@ -112,6 +102,8 @@ The `mods` property accepts the following modifiers you can override:
112102

113103
### [Additional Examples as needed]
114104

105+
**Each example must show actual code, not just reference a story.**
106+
115107
## Accessibility
116108

117109
### Keyboard Navigation
@@ -163,84 +155,55 @@ This component supports all [Field properties](/field-properties.md) when used w
163155
- [RelatedComponent2](/components/RelatedComponent2) - Complementary component
164156
```
165157

166-
## Specific Guidelines
167-
168-
### 1. Component Description
158+
## Guidelines
169159

170-
- Start with a clear, concise description of what the component is
171-
- Follow with scenarios where the component should be used
172-
- Avoid technical implementation details in the introduction
173-
174-
### 2. Properties Documentation
175-
176-
#### Base Properties
177-
- If the component uses `filterBaseProps`, don't list base properties individually
178-
- Instead, include the link: `Supports [Base properties](/base-properties.md)`
179-
- Exception: Always document the `qa` property if it has special behavior
180-
181-
#### Styling Properties
182-
- Document each `styles` or `*Styles` property separately
183-
- For each styling property, list all available tasty sub-elements with descriptions. Count only those sub-elements that are mentioned in tasty styles in the root element inside component and can be overrided by passing an object with a specific key (sub-element name) to `styles` property
184-
- Format: `ElementName` - Description of what this element represents
185-
186-
#### Style Properties
187-
- List all properties that can be used for direct styling (e.g., `width`, `height`, `padding`)
188-
- These are properties that map to `tasty` styles without using the `styles` prop
189-
- Use `src/tasty/styles/list.ts` file to understand how it works.
160+
### Properties
190161

191-
#### React Aria Properties
192-
- Document all React Aria properties with clear descriptions
193-
- It's acceptable to rewrite React Aria descriptions for clarity
194-
- Focus on practical usage rather than technical implementation
162+
- **Props List**: Use `<Controls of={componentStories.Default} />` - DO NOT manually list props if Controls is used
163+
- **Base Properties**: Link to `/base-properties.md` instead of listing (unless `qa` has special behavior)
164+
- **Styling Properties**: Document `styles`/`*Styles` props. List sub-elements that can be overridden (check component's tasty styles)
165+
- **Style Properties**: List direct styling props (`width`, `height`, etc.) - see `src/tasty/styles/list.ts`
166+
- **React Aria Properties**: Only document if adding clarifications beyond what Controls shows
195167

196-
### 3. Examples
168+
### Examples
197169

198-
- Provide practical, real-world examples written in `jsx` code
199-
- Avoid styling examples unless it demonstrates essential capabilities
200-
- Each example should have a clear purpose and title
201-
- Do not use Storybook's Canvas and Story components for interactive examples
202-
- Each story should describe a usage case
203-
- The more sophisticated component, the more stories we need to cover all cases
170+
- **CRITICAL**: Must include JSX code snippets, not just story references
171+
- Provide real-world examples with clear purpose
172+
- Avoid pure styling examples unless demonstrating essential capabilities
173+
- More sophisticated components need more examples to cover all cases
204174

205-
### 4. Modifiers
175+
### Modifiers
206176

207-
- Document all available modifiers that can be passed via the `mods` property
208-
- Explain how each modifier affects the component's appearance or behavior
209-
- Include any modifier combinations that have special behavior
177+
- Document all `mods` property values
178+
- Explain effects on appearance/behavior
179+
- Note special modifier combinations
210180

211-
### 5. Accessibility Section
181+
### Accessibility
212182

213-
- Include keyboard navigation patterns
214-
- Document screen reader behavior
215-
- List relevant ARIA properties and their usage
216-
- Provide guidance on ensuring accessible implementations
183+
- Keyboard navigation patterns
184+
- Screen reader behavior
185+
- Relevant ARIA properties
186+
- Accessible implementation guidance
217187

218-
### 6. Form Integration
188+
### Form Integration
219189

220-
For input components (TextInput, Select, DatePicker, etc.):
221-
- Don't duplicate field property documentation
222-
- Include: "This component supports all [Field properties](/field-properties.md) when used within a Form."
190+
For input components: "This component supports all [Field properties](/field-properties.md) when used within a Form."
223191

224-
### 7. File Naming and Location
192+
### File Naming
225193

226-
- Documentation files use `.docs.mdx` extension
227-
- Place in the same directory as the component
228-
- Naming convention: `ComponentName.tsx` → `ComponentName.docs.mdx`
194+
`ComponentName.tsx` → `ComponentName.docs.mdx` in same directory
229195

230196
## Review Checklist
231197

232-
Before submitting component documentation, ensure:
233-
234-
- [ ] Follows the prescribed structure
235-
- [ ] Includes practical examples with Storybook Stories
236-
- [ ] Documents all styling properties and sub-elements
237-
- [ ] Lists all modifiers with descriptions
238-
- [ ] Includes accessibility information
239-
- [ ] Contains best practices section
240-
- [ ] Has "Suggested Improvements" section
241-
- [ ] Uses correct file naming and location
242-
- [ ] All links use provided placeholder format
243-
- [ ] Style properties are documented separately from styling properties
244-
- [ ] Form integration mentioned for input components
198+
- [ ] **JSX code snippets provided (not just stories)**
199+
- [ ] **No manual props list if using `<Controls />`**
200+
- [ ] Follows prescribed structure
201+
- [ ] Styling properties and sub-elements documented
202+
- [ ] Modifiers listed with descriptions
203+
- [ ] Accessibility section complete
204+
- [ ] Best practices included
205+
- [ ] Suggested improvements section
206+
- [ ] Style props vs styling props separated
207+
- [ ] Form integration noted (input components)
245208
- [ ] Base properties linked, not listed (except `qa`)
246-
- [ ] Tabler (`@tabler/icons-react`) or UI Kit icons are used in examples
209+
- [ ] Icons from `@tabler/icons-react` or `/src/icons`

src/components/content/Item/Item.docs.mdx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ A foundational component that provides a standardized layout and styling for ite
2525

2626
<Controls of={ItemStories.Default} />
2727

28-
### Base Properties
29-
30-
Supports [Base properties](/BaseProperties)
28+
Supports [Base properties](/docs/tasty-base-properties--docs)
3129

3230
## Styling
3331

@@ -206,7 +204,9 @@ Item supports inline actions that appear on the right side. Use the `Item.Action
206204
</Item>
207205
```
208206

209-
Actions automatically inherit the parent's `type` prop and adjust their styling accordingly. The component reserves space for actions to prevent content overlap.
207+
Actions automatically inherit the parent's `type` and `theme` props and adjust their styling accordingly. The component reserves space for actions to prevent content overlap.
208+
209+
By default, action buttons are focusable. Use `disableActionsFocus={true}` to prevent them from receiving keyboard focus.
210210

211211
#### Show Actions on Hover
212212

@@ -371,14 +371,15 @@ By default, Item shows an auto tooltip when content overflows.
371371
## Related Components
372372

373373
- [ItemButton](/docs/actions-itembutton--docs) - Interactive button built on Item
374-
- [Item.Action](/docs/actions-itemaction--docs) - Action button component for inline actions (also available as `ItemButton.Action`, `Menu.Item.Action`, etc.)
375-
- [Select](/docs/forms-select--docs) - Dropdown selection component using Item
376-
- [ComboBox](/docs/forms-combobox--docs) - Searchable dropdown component using Item
377-
- [ListBox](/docs/forms-listbox--docs) - List selection component using Item
378-
- [FilterListBox](/docs/forms-filterlistbox--docs) - Filterable list component using Item
379-
- [FilterPicker](/docs/forms-filterpicker--docs) - Filter selection component using Item
374+
- [ItemAction](/docs/actions-itemaction--docs) - Action button component for inline actions (also available as `Item.Action`, `ItemButton.Action`, `Menu.Item.Action`, etc.)
375+
- [ItemBadge](/docs/content-itembadge--docs) - Badge component for displaying labels or counts (also available as `Item.Badge`)
376+
- [Select](/docs/fields-select--docs) - Dropdown selection component using Item
377+
- [ComboBox](/docs/fields-combobox--docs) - Searchable dropdown component using Item
378+
- [ListBox](/docs/fields-listbox--docs) - List selection component using Item
379+
- [FilterListBox](/docs/fields-filterlistbox--docs) - Filterable list component using Item
380+
- [FilterPicker](/docs/fields-filterpicker--docs) - Filter selection component using Item
380381
- [Menu](/docs/actions-menu--docs) - Context menu component using Item
381382
- [CommandMenu](/docs/actions-commandmenu--docs) - Command palette component using Item
382383
- [Button](/docs/actions-button--docs) - Traditional button component
383384
- [Link](/docs/navigation-link--docs) - Text link component
384-
- [Text](/docs/generic-text--docs) - Typography component for simple text
385+
- [Text](/docs/content-text--docs) - Typography component for simple text

0 commit comments

Comments
 (0)