Skip to content

Presence

Open .md
Live preview

Loading example…

CrossFade between the children and nothing: shows or hides content with a fade.

import { Presence } from "@jcsoftdev/ui/motion";
export const RevealOnMount: Story = {
render: () => (
<Replay>
{() => (
<Reveal>
<Card className="max-w-sm p-card">Welcome back. Three tasks are waiting for you.</Card>
</Reveal>
)}
</Replay>
),
};

Source of the Storybook story.

Prop Type Default Description
present * boolean Shows the children when true; changes fade them in and out.
ref Ref<HTMLDivElement>
children ReactNode

* marks a required prop.

It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).

packages/ui/src/motion/cross-fade.tsx