For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
Shadcn Labs/

Morphing Popover

A trigger that morphs into its popover surface and back. A React component built on View Transitions, installed with the shadcn CLI.

Installation

$ pnpm dlx shadcn@latest add @transition-kit/morphing-popover

Usage

import {
  MorphingPopover,
  MorphingPopoverClose,
  MorphingPopoverContent,
  MorphingPopoverTitle,
  MorphingPopoverTrigger,
} from "@/components/transitions/morphing-popover";
<MorphingPopover>
  <MorphingPopoverTrigger>
    <MessageSquareIcon />
    Feedback
  </MorphingPopoverTrigger>
  <MorphingPopoverContent>
    <MorphingPopoverTitle>
      <MessageSquareIcon />
      Feedback
    </MorphingPopoverTitle>
    <textarea aria-label="Your feedback" />
    <MorphingPopoverClose>Cancel</MorphingPopoverClose>
  </MorphingPopoverContent>
</MorphingPopover>
<MorphingPopoverContent side="top" align="end">
  …
</MorphingPopoverContent>
const SendButton = () => {
  const { setOpen } = useMorphingPopover();
  return (
    <button type="submit" onClick={() => setOpen(false)}>
      Send
    </button>
  );
};

API Reference

MorphingPopover

PropTypeDefaultDescription
openboolean-Controlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void-Called when the open state is requested to change.

MorphingPopoverContent

PropTypeDefaultDescription
side"bottom" | "top""bottom"Which way the panel grows.
align"start" | "center" | "end""start"Which trigger edge the panel lines up with.

useMorphingPopover

ReturnTypeDescription
openbooleanWhether the popover is open.
setOpen(open: boolean) => voidOpens or closes with the trigger animation.