Components / Lines

Dash Patterns

Dashed lines with the dash and the gap set independently, which a CSS border cannot do.

dash 6 · gap 4

Customize

Dash
6px
Gap
4px
Line
1px
Overshoot
0px

Installation

Dash Patterns 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

  • Rules are four straight lines, so they ignore the radius. For a dashed line that follows rounded corners use FrameBorder with the dashed variant.

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.