Dashral Pro is on the wayGet 30% off at launch

Dashral

Popover

Popover with motion: it springs out of its trigger from the side it opens on, and glides to its new height when what's inside changes.

$ pnpm dlx shadcn@latest add https://dashral.com/r/motion-popover.json

Installation

$ pnpm dlx shadcn@latest add https://dashral.com/r/motion-popover.json

Adds components/dashral/motion/popover.tsx, the Popover it builds on (in components/dashral/), motion and the motion files every motion component shares. With the registry in your components.json:

$ pnpm dlx shadcn@latest add @dashral/motion-popover

Usage

The same as Popover, imported from components/dashral/motion/: swap the import and it moves.

example.tsx
import { Popover } from "@/components/dashral/motion/popover"

<Popover trigger={<Button variant="outline">Filters</Button>}>
  <FiltersForm />
</Popover>

Examples

Filters

Add a rule and the panel glides taller, remove one and it glides back; Apply works, then the count on the button turns.

Share

Invite someone and they slide into the list as the panel grows; change a role and it rises into its select.

Compared with Default

Default

Fades and zooms in from 95%; when what's inside changes, its height jumps.

Motion

Springs out of its trigger from its own side, and glides to a new height when what's inside changes.

How the two editions differ in general, and which to use where: Motion.

API reference

Every prop of Popover, and every attribute of the element it renders. The Motion edition adds no props of its own.

Popover

Also takes every prop of Radix Popover(opens in a new tab).

PropTypeDefault
triggerReactElement

What opens it, e.g. a button. Required.

—
childrenReactNode

The panel's content.

—
side / align

Where it opens.

"bottom" / "center"
open / onOpenChange

Control it yourself.

—
classNamestring

The panel's classes, e.g. a width or p-0.

—

Motion

  • It springs out of its trigger from the side it opens on (--duration-standard, a hint of overshoot), from 94% and 6px back toward the trigger; it leaves quickly.
  • When what's inside changes (a rule added, a person invited, a message after saving) it glides to the new height with no overshoot; it's clipped only while it glides.
  • With reduced motion it only fades, and its height follows at once.