diff --git a/apps/web/src/components/ui/EmptyState/EmptyState.tsx b/apps/web/src/components/ui/EmptyState/EmptyState.tsx index 61e7919..de165e4 100644 --- a/apps/web/src/components/ui/EmptyState/EmptyState.tsx +++ b/apps/web/src/components/ui/EmptyState/EmptyState.tsx @@ -15,6 +15,13 @@ export type EmptyStateProps = { action?: ReactNode; variant?: EmptyStateVariant; size?: EmptyStateSize; + /** + * Heading level for the title. Defaults to 3 for empty states inside a + * page section. Use 1 when the empty state is the whole page (for example + * "Recipe not found") so the page still has a top-level heading. + * The visual size comes from the size prop, not from the level. + */ + headingLevel?: 1 | 2 | 3 | 4; }; function EmptyState({ @@ -25,7 +32,10 @@ function EmptyState({ action, variant = 'surface', size = 'md', + headingLevel = 3, }: EmptyStateProps) { + const Heading = `h${headingLevel}` as const; + return (
{description}
)} diff --git a/apps/web/src/components/ui/README.md b/apps/web/src/components/ui/README.md index 2ed7c71..7014417 100644 --- a/apps/web/src/components/ui/README.md +++ b/apps/web/src/components/ui/README.md @@ -693,7 +693,7 @@ The component chooses the matching semantic icon and live-region role. **Sizes:** `sm | md`. -**Important props:** `icon`, `title`, `description`, `action`. +**Important props:** `icon`, `title`, `description`, `action`, `headingLevel` (default `3`; use `1` when the empty state is the whole page). ```tsx