Components / Shapes

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

Corner
Size
16px
Line
1px
Top left
Top right
Bottom right
Bottom left
Punched edges

Installation

npx shadcn@latest add https://fancyborders.vercel.app/r/shape-frame.json

The 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

tsx
import { ShapeFrame } from "@/components/ui/shape-frame";
PropTypeDefault
cornerCornerShape | 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
sizenumber

Size of the corner treatment, in pixels.

12
linenumber

Line 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).

–
fillstring

Background painted inside the shape. Any CSS background works.

–
pathShapePath

A ready-made outline from polygonPaths, in place of the corners and the punch.

–

Also accepts every Frame prop except radius, and every div attribute.