Presence
Animates content when it is shown or hidden.
presence-demo.tsx
Installation
The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.
npm
yarn
pnpm
bun
Inline status
Keep the output element outside Presence, so screen readers announce the change.
presence-inline-demo.tsx
API reference
- show: booleanRequired
- Shows or hides the content. The content is inert during its exit. Move focus before you hide focused content.
- as: "div" | "span" = "div"
- Outer element. A span is inline-block, so it can move.
- distance: number = 8
- Travel in pixels for the entrance and the exit.
- duration: number = 0.2
- Entrance time in seconds. The exit takes 70% of this time.