Media Page Header
Page-level building blocks for media library screens: header, empty, loading and error states.
A set of page-level building blocks for media library screens: a header with a title, description, sync button, error banner, and optional stat chips, plus matching empty, loading, and error states.
Import
import {
MediaPageHeader,
MediaEmptyState,
MediaLoadingState,
MediaErrorState,
} from "@yuhuanowo/yunui/patterns";
Header
onSync is a function, which can't cross the server→client boundary in MDX, so the header is rendered from a small client wrapper.
MediaPageHeader
Media library
All your synced images and videos.
Empty state
The icon prop takes a Lucide component (a function), so this example is also rendered from a client wrapper.
MediaEmptyState
Loading & error states
MediaLoadingState and MediaErrorState are static and can be used directly. MediaErrorState accepts an optional onRetry callback to render a retry button.
MediaLoadingState
MediaErrorState
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| description* | string | — | Page subtitle/description. |
| isSyncing* | boolean | — | While true, the sync button spins and is disabled. |
| onSync* | () => void | — | Called when the sync button is clicked. |
| stats | { label: string; value: string | number; }[] | — | Optional inline stat chips (`label` + `value`) below the header. |
| syncError* | string | null | — | Sync error message; shown in a red banner when non-null. |
| title* | string | — | Page title. |
| Prop | Type | Default | Description |
|---|---|---|---|
| action | ReactNode | — | Action slot (e.g. a button) below the text. |
| description* | string | — | Supporting text below the title. |
| icon* | ElementType | — | Icon component shown above the title. |
| title* | string | — | Heading text. |
| Prop | Type | Default | Description |
|---|---|---|---|
| message | string | — |
| Prop | Type | Default | Description |
|---|---|---|---|
| message* | string | — | |
| onRetry | (() => void) | — |