YuhuanStudioYunUIDocs
Patterns

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";

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.

128items
6albums

Empty state

The icon prop takes a Lucide component (a function), so this example is also rendered from a client wrapper.

MediaEmptyState

No media yet
Sync a source to start filling your library.

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

Loading your media…

MediaErrorState

Error
Could not reach the media service.

Props

PropTypeDefaultDescription
description*stringPage subtitle/description.
isSyncing*booleanWhile true, the sync button spins and is disabled.
onSync*() => voidCalled when the sync button is clicked.
stats{ label: string; value: string | number; }[]Optional inline stat chips (`label` + `value`) below the header.
syncError*string | nullSync error message; shown in a red banner when non-null.
title*stringPage title.
PropTypeDefaultDescription
actionReactNodeAction slot (e.g. a button) below the text.
description*stringSupporting text below the title.
icon*ElementTypeIcon component shown above the title.
title*stringHeading text.
PropTypeDefaultDescription
messagestring
PropTypeDefaultDescription
message*string
onRetry(() => void)

On this page