Shape Frame
A frame whose outline follows a shape: bevelled, notched, scooped or rounded corners, and edges with a bite taken out.
bevel, 16px
Customize
Installation
npx shadcn@latest add https://fancyborders.vercel.app/r/shape-frame.jsonThe CLI copies the component into your project, adds anything it is built on, and writes its CSS into your global stylesheet. New to the CLI? See Installation.
Examples
A different corner each
Pass an object to give every corner its own treatment.
One of each
With Tailwind variants
The fill and line colour are utilities, so they change on hover like any other.
hover:frame-color-sky-500
Good to know
- The border, fill and drop-shadow filter follow the shape in every browser. Where border-shape is supported (Chromium 147 and later) the focus outline, box-shadow and hit area follow it too.
- Curved corners (round and scoop) need the CSS shape() function and fall back to a plain rectangular border without it.
- A shape frame is still a frame, so corner marks, fills and effect layers compose inside it.
- For an outline of your own, build it with polygonPaths and pass it as path. The folder, the speech bubble and the edge frame are made this way.
API reference
ShapeFrame
import { ShapeFrame } from "@/components/ui/shape-frame";| Prop | Type | Default |
|---|---|---|
| corner | CornerShape | Partial<Record<Corner, CornerShape>>Corner treatment: "square", "round", "bevel", "notch" or "scoop". One for every corner, or an object with one per corner. | "bevel" |
| corners | ("tl" | "tr" | "br" | "bl")[]Limits a single corner treatment to these corners. | all four |
| size | numberSize of the corner treatment, in pixels. | 12 |
| line | numberLine width, in pixels. | 1 |
| punch | { sides?, at?, radius? }Semicircular bites out of the edges: which sides (left and right by default), where along the edge (the middle), and their radius (8). | – |
| fill | stringBackground painted inside the shape. Any CSS background works. | – |
| path | ShapePathA ready-made outline from polygonPaths, in place of the corners and the punch. | – |
Also accepts every Frame prop except radius, and every div attribute.