Shape
Thirty-four soft shapes, from circles and pills to cookies, clovers, bursts and pixel shapes. Use them for avatars, image crops, icon containers and small moments of expression. Every shape morphs into every other.
Install
npx shadcn@latest add @nelumbo/shapeUsage
import { Shape } from "@/components/ui/shape"<Shape name="cookie-9" className="size-24 bg-brand-container" /><Shape name="arch" className="size-40"> <img src="/samples/organoid.jpg" alt="Liver organoid, day 14" /></Shape>Library
Pick a shape to morph the preview into it, or press Play to run through them all. Every shape has the same number of points, starting at 12 o'clock, so any shape morphs into any other.
name="cookie-9"Avatars
A shape gives each person a recognizable mark. Keep one shape per person, so the shape itself helps people find someone in a long list.
Icon containers and morphing on hover
Change the name on hover or selection and the shape morphs with the standard easing, without a bounce. With reduced motion it switches at once.
Loading indicator
LoadingIndicator morphs through seven shapes from this library: soft burst, cookie 9, pentagon, pill, sunny, clover 4 and oval.
In your own CSS
shapePath returns the polygon() for any element, and SHAPE_NAMES lists every name.
import { shapePath, SHAPE_NAMES } from "@/components/ui/shape"<figure style={{ clipPath: shapePath("clover-8") }}>…</figure>// the loading indicator fits shapes in a circle so they can turnshapePath("sunny", { fit: "circle" })Props
| Prop | Type | Default | Notes |
|---|---|---|---|
| name | ShapeName | — | One of 34 shapes, e.g. "cookie-9", "arch", "pixel-circle". |
| morph | boolean | true | Morph when name changes. |
| children | ReactNode | — | Clipped to the shape; an img or video fills it. The clip also cuts shadows and focus rings, so put those on a wrapper. |
| shapePath(name, options) | string | — | options.fit "box" (default) or "circle"; options.points (144). |