Components

Popover

The shadcn/ui Popover that grows out of its trigger with a short, calm animation and a neutral shadow — plus two animated React popover blocks built with Motion and Radix: a spring popover that scales from the trigger's origin, and a feedback button that morphs into a form.

  • Drop-in shadcn API
  • Radix positioning
  • Motion blocks
  • prefers-reduced-motion

Installation

$ npx shadcn@latest add https://duskui.com/r/popover.json

Replaces components/ui/popover.tsx with the same exports and props, plus PopoverClose. Animations are CSS (tw-animate-css), so the base needs no Motion.

Usage

layer-settings.tsx
import { Button } from "@/components/ui/button"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"

export function LayerSettings() {
  return (
    <Popover>
      <PopoverTrigger asChild>
        <Button variant="outline">Dimensions</Button>
      </PopoverTrigger>
      <PopoverContent>{/* form */}</PopoverContent>
    </Popover>
  )
}

Examples

Default

Scales out of the trigger with a short ease-out and closes quicker than it opened. Focus moves into the popover; Escape or a click outside closes it and focus returns to the trigger.

Sides

The scale origin comes from --radix-popover-content-transform-origin, so the popover always grows from the edge facing its trigger — including after Radix flips it to stay on screen.

Blocks

Ready-made variations composed from the base component with Motion. Each installs on its own and pulls in its dependencies automatically.

Animated Popover

A Motion-powered popover that scales out of its trigger's transform origin, then fades its content in a beat later; the exit is short and crisp. Optional showArrow draws an arrow that follows Radix's placement.

$ npx shadcn@latest add https://duskui.com/r/animated-popover.json
PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void—Open state (on AnimatedPopover).
AnimatedPopoverTrigger / Anchor / CloseRadix props—Use asChild to render your own elements.
AnimatedPopoverContentRadix Content props & { showArrow?: boolean }—side, align (default center), sideOffset (default 8)…

Feedback Popover

A pill button that morphs into a feedback form: the surface, icon and label share Motion layoutIds, so the pill stretches into the panel and the label flies into the title. Return a promise from onSubmit for a loading state; throw to show an error inline (type “error” in the demo). On success it shows a check, then shrinks back into the button. It renders inline rather than in a portal so the morph can be measured, so leave room around it.

$ npx shadcn@latest add https://duskui.com/r/feedback-popover.json
PropTypeDefaultDescription
onSubmit(message: string) => unknown | Promise<unknown>—Runs on submit. Throw to keep the panel open with an error.
labelstring"Feedback"Button text and panel title.
iconReactNode | null—Leading icon. null hides it.
placeholderstring—Textarea placeholder.
successMessageReactNode—Shown after a successful submit.
successDurationnumber1600Milliseconds to show the success state before closing.
maxLengthnumber—Character limit; shows a counter.
side / align"top" | "bottom" / "start" | "end""bottom" / "start"Open downward or upward, from the left or right edge.
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void—Open state.
panelClassNamestring—Classes for the open panel, e.g. a width.

API Reference

Same parts as shadcn/ui: Popover, PopoverTrigger, PopoverContent and PopoverAnchor, plus PopoverClose. Each forwards the Radix Popover props.

PropTypeDefaultDescription
open / onOpenChangeboolean / (open: boolean) => void—Controlled state (on Popover).
modalbooleanfalseTrap focus and block outside interaction (on Popover).
side / align / sideOffsetstring / string / number"bottom" / "center" / 6Placement (on PopoverContent).
onOpenAutoFocus / onEscapeKeyDown / onInteractOutside(event) => void—Radix hooks on PopoverContent; call preventDefault() to override.

Accessibility

  • Built on Radix Popover: the trigger has aria-expanded and aria-controls, the content is a role="dialog", Escape and outside clicks close it and focus returns to the trigger.
  • Feedback Popover follows the same pattern by hand: aria-expanded / aria-haspopup="dialog" on the button, a labelled dialog, focus on the textarea, Escape to close, and errors and success announced via role="alert" / role="status".
  • Under prefers-reduced-motion popovers only fade and the feedback button crossfades instead of morphing.