Loading...
Loading...
Generate comprehensive component documentation (architecture, API, examples, known issues). Works with React, Vue, Angular, and Web Components. | Genera documentación completa de componentes (arquitectura, API, ejemplos, issues conocidos). Compatible con React, Vue, Angular y Web Components.
npx skill4agent add jrodrigopuca/skills create-component-docs| Type | Characteristics | Documentation Focus |
|---|---|---|
| Presentational | No state, receives props, renders UI | Props, variants, styling |
| Container | Manages state, data fetching | State flow, side effects |
| Composite | Combines multiple components | Internal structure, slots |
| Utility | Hooks, HOCs, render props | API, return values, usage patterns |
## Props
| Prop | Type | Default | Required | Description |
| ---------- | ----------------------------- | ----------- | -------- | ---------------------- |
| `variant` | `'primary' \| 'secondary'` | `'primary'` | No | Visual style variant |
| `onClick` | `(event: MouseEvent) => void` | - | Yes | Click handler callback |
| `children` | `ReactNode` | - | Yes | Content to render |
| `disabled` | `boolean` | `false` | No | Disables interaction |See [ButtonProps](../types/button.ts#L12-L25) for complete type definition.## Events
| Event | Payload | Description |
| ---------- | ----------------------------------- | -------------------------- |
| `onChange` | `{ value: string, valid: boolean }` | Emitted on input change |
| `onSubmit` | `FormData` | Emitted on form submission |## Architecture
`mermaid
graph TD
A[DataTable] --> B[TableHeader]
A --> C[TableBody]
A --> D[TableFooter]
C --> E[TableRow]
E --> F[TableCell]
A --> G[Pagination]
`## State Flow
`mermaid
stateDiagram-v2
[*] --> Idle
Idle --> Loading: fetch()
Loading --> Success: data received
Loading --> Error: request failed
Success --> Idle: reset()
Error --> Loading: retry()
`## Dependencies
| Dependency | Purpose | Required |
| ----------------------- | --------------------- | -------- |
| `ThemeContext` | Provides color tokens | Yes |
| `useTranslation` | i18n support | No |
| `@tanstack/react-query` | Data fetching | Yes |## Lifecycle
1. **Mount:** Registers event listeners, fetches initial data
2. **Update:** Re-renders on prop/state change, debounces API calls
3. **Unmount:** Cleans up listeners, cancels pending requests## Known Issues
| Issue | Severity | Workaround | Status |
| ------------------------------- | --------- | -------------------- | ------------ |
| Flickers on rapid re-render | 🟡 Medium | Use `memo()` wrapper | Open |
| Doesn't support RTL layout | 🟢 Low | Apply manual CSS | Planned v2.1 |
| Memory leak with large datasets | 🔴 High | Limit to 1000 items | In Progress |## Examples
### Basic Usage
`tsx
<Button variant="primary" onClick={handleClick}>
Click me
</Button>
`
### With Loading State
```tsx
<Button
variant="primary"
loading={isSubmitting}
disabled={!isValid}
onClick={handleSubmit}
> {isSubmitting ? 'Saving...' : 'Save'}
> </Button>
> ```
### Composition with Icons
`tsx
<Button variant="secondary">
<Icon name="download" />
<span>Download Report</span>
</Button>
`See [Storybook](https://your-storybook.com/?path=/docs/components-button) for interactive examples.| Section | When to Include | Priority |
|---|---|---|
| Props/API | Always | 🔴 Required |
| Examples | Always | 🔴 Required |
| Architecture | Composite components | 🟡 Recommended |
| State Flow | Stateful components | 🟡 Recommended |
| Dependencies | Has external deps | 🟡 Recommended |
| Known Issues | Has limitations | 🟢 If applicable |
| Lifecycle | Complex side effects | 🟢 If applicable |