Motion UIComponentsComponent

Page curtain

A slanted clip-wipe page transition that carries the incoming page name across the screen.

npx shadcn@latest add @motion/page-curtain

API reference

Components

<PageCurtainStage />

Scoped section the curtain wipes across.

announce

string

Live-region text announced on every page change.

children

ReactNode

Page shell: header, content, tabs.

className?

string

Merged onto the <section>.

ref?

Ref<HTMLElement>

From usePageCurtain().ref.

<PageCurtainContent />

Static page-body wrapper.

children

ReactNode

Current page body.

className?

string

Merged onto the wrapper.

<PageCurtainTabs />

Page-switch nav with active wash and pending disable.

labels

string[]

Page labels in order.

active

number

Active page index.

isPending?

boolean

Disable tabs while a transition is pending.

onSelect

(index: number) => void

Navigate to a page.

"aria-label"?

string

Accessible nav name. Default "Pages".

className?

string

Merged onto the <nav>.

Hooks

usePageCurtain

Page-curtain controller wrapping Motion+'s useCurtains.

usePageCurtain(options: UsePageCurtainOptions): PageCurtain

titles

string[]

Per-page titles painted onto the curtain.

angle?

number = 9

Wipe edge tilt in degrees. Default 9.

initial?

number = 0

Initial page index. Default 0.

Returns

page

number

Current page index.

isPending

boolean

Whether a transition is in flight.

go

(next: number) => void

Navigate to a page index.

ref

RefObject<HTMLElement | null>

Attach to PageCurtainStage.

Functions

titledClipWipe

clipWipe curtain effect that paints title onto the covering overlay. clipWipe(options) returns the effect directly, not a factory.

titledClipWipe(title: string, options: TitledClipWipeOptions): CurtainEffectFactory

pageCurtainDirection

Wipe direction from index delta.

pageCurtainDirection(current: number, next: number): "left" | "right"