Skip to main content

Examples

No runnable examples are generated for this component yet. See the Storybook entry for live variants.

Props

MorphPanel

Animates a panel between views, such as the steps of a dialog or the sub-views of a sheet. When step changes, the panel morphs from its old height to the new view’s height over 300ms. The old view fades out quickly and the new one fades in with an 8px nudge, from the right when going deeper (a higher step) or from the left when going back. A part marked data-morph-static, such as a dialog header, holds still and only its heading crossfades. If the new view changes size within a second of the step change, for example when its data loads, the panel eases to the new height instead of snapping. With reduced motion the views swap instantly. The first view appears without a transition, so the panel’s own entrance animation plays alone. Children keep their state across steps, and focus moves to the new view’s heading. DialogContent and DrawerContent wrap their children in one when given a step.
number
required
Which view is showing, in navigation order: a higher step is deeper. Changing it plays the transition; the view’s own content changing does not.Changing it does not remount the children: React reconciles them as usual, so content that stays across steps (such as a form wrapping every step and its uncontrolled inputs) keeps its state, and only the parts that differ between steps mount afresh. Give a view its own key to reset its state on entry.After a change, focus moves to the first heading in the panel, so screen readers announce the new view, unless focus has already gone somewhere outside the panel.

Exported types

Also exported from @fanvue/ui: MorphPanelProps.
Setup: Installation · Theming