Components / Lines

Marching Ants

Dashed rules whose dashes travel around the frame, like a selection rectangle.

Selection

Customize

Dash
6px
Gap
4px
Step time
0.6s
Line
1px
Corner handles

Installation

Marching Ants is a recipe: a few layers of frame put together, not a component of its own. Install frame, then copy the code from the preview above.

npx shadcn@latest add https://fancyborders.vercel.app/r/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.

Good to know

  • The dashes stand still for people who ask for reduced motion.

API reference

FrameRules

tsx
import { FrameRules } from "@/components/ui/frame";
PropTypeDefault
sides("top" | "right" | "bottom" | "left")[]

Which sides get a line.

all four
overshootnumber | string | { x?, y? }

How far the lines run past the corners. x extends the horizontal lines, y the vertical ones.

0
dashnumber | string

Dash length. Setting dash or gap makes the lines dashed.

4
gapnumber | string

Space between dashes.

4
marchboolean | number

Make the dashes travel clockwise. A number is the seconds a dash takes to reach the next one's place; true is 0.6.

false
offsetnumber | string

Distance from the frame's edge. Positive is outward, negative inward.

0
colorstring

Overrides the frame's line colour for this layer.

–

Also accepts every div attribute, such as className and style.