Loading...
Loading...
Create or update component documentation in Sentry's MDX stories format. Use when asked to "document a component", "add stories", "write component docs", "create an mdx file", "add a stories.mdx", or document a design system component. Generates structured MDX with live demos, accessibility guidance, and auto-generated API docs from TypeScript types.
npx skill4agent add getsentry/sentry react-component-documentation.mdxstatic/app/components/core/Grepstatic/app/views/| Question | Where it surfaces in the docs |
|---|---|
| When should a developer reach for this component? | Introduction or a |
| When should they NOT use it — and what should they use instead? | |
| What does each variant/priority mean semantically? | Description in each variant's section (e.g., " |
| What do developers commonly get wrong? | |
| Does this component require a specific parent, peer, or provider to work correctly? | Noted in the introduction or a |
| Are there related components that overlap in purpose? | |
| Which props and variants are worth documenting with a demo? | See prop triage below |
| Tier | Document how | Examples |
|---|---|---|
| Core — defines the component's primary behavior or appearance | Full | |
| Modifier — adjusts a single aspect; values are self-explanatory | Brief mention with a demo, or a single combined demo with other modifiers | |
| Structural — controls layout or composition | Demo showing the before/after or compound usage | |
| Internal / pass-through — not user-facing | Skip entirely | |
dangerstatic/app/components/core/<category>/<component>/index.tsx
static/app/components/core/<category>/<component>/<component>.tsxComponent.SubComponentexport {TabList, TabPanels}<component-dir>/<component>.mdxstatic/app/components/core/@sentry/scraps/<name>sentry/components/<path>@sentry/scraps.mdx@sentry/scraps/<name>@sentry/scraps/<name>/<name>---
title: <ComponentName>
description: <One sentence describing what it is and its primary purpose.>
category: <category> # See category table below; omit for principle docs
source: '@sentry/scraps/<component>' # or 'sentry/<path>' for product components
resources:
figma: <figma-url> # Include if known
js: https://github.com/getsentry/sentry/blob/master/static/app/components/core/<path>
a11y: # Include for interactive components
WCAG 1.4.3: https://www.w3.org/TR/WCAG22/#contrast-minimum
WAI-ARIA <Pattern> Practices: https://www.w3.org/WAI/ARIA/apg/patterns/<pattern>/
---| Category | Components |
|---|---|
| Button, ButtonBar, LinkButton |
| Input, Select, Checkbox, Radio, Slider, Switch |
| Tabs, SegmentedControl, Disclosure |
| Alert, Badge, Tag, Toast |
| Flex, Grid, Stack, Container, Surface |
| Text, Heading, Prose |
| design patterns, principles |
layout: documentcategorya11y:reference:// 1. External packages (react, etc.) — only if needed for examples
import {useState} from 'react';
// 5. Type-loader for auto-generated API docs (@sentry/scraps components only)
import documentation from '!!type-loader!@sentry/scraps/<component>';
// 3. @sentry/scraps component(s)
import {ComponentName} from '@sentry/scraps/<component>';
// 2. Sentry internals used in examples (icons, utils)
import {IconAdd, IconEdit} from 'sentry/icons';
// 4. Stories namespace (always last before type-loader)
import * as Storybook from 'sentry/stories';
export {documentation};@sentry/scrapsexport {documentation}import RawDocumentation from '!!type-loader!@sentry/scraps/<component>';
export const documentation = {
exports: RawDocumentation.exports,
props: {
...RawDocumentation?.props,
// Remove internal props if needed
},
};<Storybook.SideBySide>#### Sizes## Priorities## States## Composition## Sizes## Variants## States## The size prop## When to use
Use `<Alert>` for inline feedback within a page. For application-level banners that span the full viewport, use the `system` prop or reach for `<Toast>` if the message is transient.
> [!WARNING]
> Do not use `<Alert variant="danger">` for confirmation dialogs. Use a modal instead.## See Also
- [LinkButton](/stories/core/linkbutton/) — use when the action navigates to a new URL
- [Link](/stories/core/link/) — use for inline text navigation, not standalone CTAsTo create a basic <component>, wrap content in `<ComponentName>`.
```jsx
<ComponentName prop="value">Content</ComponentName>
```
### Sub-components
When a component exposes sub-components, show the full compound usage early:
```mdx
`<Tabs>` is a compound component. Use `<TabList>` and `<TabPanels>` together:
```jsx
<Tabs>
<TabList>
<TabList.Item key="tab1">Tab 1</TabList.Item>
</TabList>
<TabPanels>
<TabPanels.Item key="tab1">Content 1</TabPanels.Item>
</TabPanels>
</Tabs>
### Demo pattern
Every feature section must have a `<Storybook.Demo>` followed **immediately** by the matching code block:
```mdx
## Sizes
<brief description>
<Storybook.Demo>
<Component size="sm">Small</Component>
<Component size="md">Medium</Component>
<Component size="lg">Large</Component>
</Storybook.Demo>
```jsx
<Component size="sm">Small</Component>
<Component size="md">Medium</Component>
<Component size="lg">Large</Component>
**Demo layout helpers:**
| Component | Use when |
|-----------|----------|
| `<Storybook.Demo>` | Default; horizontally arranges examples |
| `<Storybook.Grid>` | Grid layout for many variants |
| `<Storybook.SideBySide>` | Two-column comparisons (do/don't) |
| `<Storybook.TokenReference>` | Displaying design tokens (spacing, color, etc.) |
| `<Storybook.ColorReference>` | Displaying color tokens specifically |
### Accessibility section
```mdx
## Accessibility
This component meets [WCAG 2.2 AA](https://www.w3.org/TR/WCAG22/) standards:
- **Color contrast**: Meets 4.5:1 ratio (WCAG 1.4.3)
- **Keyboard navigation**: <what interactions are supported>
- **Screen reader support**: <ARIA role and labeling behavior>
### Developer responsibilities
- Always provide <required accessible prop> (e.g., `aria-label` or visible label text)
- <other requirement>> [!TIP]
> Use the `<prop>` prop when you need <use case>.
> [!WARNING]
> Avoid <pattern> because <reason>.
> [!NOTE]
>
> <Additional context.>@sentry/scraps## Props
| Prop | Type | Default | Description |
| --------- | --------------------------------- | -------- | ------------------------- |
| `variant` | `'info' \| 'warning' \| 'danger'` | `'info'` | Controls the visual style |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Controls the size |---
title: Alert
description: Alerts provide contextual feedback messages with different severity levels.
category: status
source: '@sentry/scraps/alert'
resources:
js: https://github.com/getsentry/sentry/blob/master/static/app/components/core/alert/index.tsx
a11y:
WCAG 1.4.3: https://www.w3.org/TR/WCAG22/#contrast-minimum
WCAG 2.1.1: https://www.w3.org/TR/WCAG22/#keyboard
WAI-ARIA Alert Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/alert/
---
import {Alert} from '@sentry/scraps/alert';
import * as Storybook from 'sentry/stories';
import documentation from '!!type-loader!@sentry/scraps/alert';
export {documentation};
To create a basic alert, wrap a message in `<Alert>` and specify the appropriate type.
```jsx
<Alert variant="info">This is an informational message</Alert>
```mutedinfowarningsuccessdanger<Alert.Container>
<Alert variant="muted">Muted</Alert>
<Alert variant="info">Info</Alert>
<Alert variant="warning">Warning</Alert>
<Alert variant="success">Success</Alert>
<Alert variant="danger">Danger</Alert>
</Alert.Container>undefined<component>.mdxtitledescriptionsource@sentry/scraps<Storybook.Demo><img><Image>