GooseUI

Components

Dashed Line

New

A horizontal or vertical dashed line that fades out at both ends and can move its dashes along. It is plain CSS without client code, so it works in server components. The color comes from currentColor, and with reduced motion the dashes stand still.

Browser Support

Masks

Creates the dashed line

Your browser:

Preview

Dashed divider with faded ends and moving dashes

Installation

npx shadcn@latest add @gooseui/dashed-line
pnpm dlx shadcn@latest add @gooseui/dashed-line
yarn dlx shadcn@latest add @gooseui/dashed-line
bunx --bun shadcn@latest add @gooseui/dashed-line

Usage

import { DashedLine } from "@/components/ui/dashed-line"

export default function Divider() {
  return <DashedLine animated />
}

Examples

Vertical connector

In a vertical line the dashes move down, or up with direction="reverse". The parent sets the length.

  1. Request
  2. Review
  3. Release
<div className="h-12">
  <DashedLine orientation="vertical" animated fade={0} dash={4} gap={4} thickness={2} />
</div>

Dash shape and color

Long dashes, a wide gap and a thicker line turn it into a road marking. The color is any text color class.

<DashedLine
  animated
  dash={24}
  gap={16}
  thickness={4}
  speed={60}
  fade={10}
  className="text-foreground"
/>

Section divider

A static line with short fades separates blocks of content.

Plans and pricing

Frequently asked questions

<DashedLine fade={5} className="text-border" />

Props

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Line direction
dashnumber6Dash length, in px
gapnumber4Gap between dashes, in px
thicknessnumber1Line thickness, in px
fadenumber15Fade at each end, in percent of the length. 0 turns it off
animatedbooleanfalseMove the dashes along the line
speednumber20Dash speed, in px per second
direction"forward" | "reverse""forward"forward moves right or down, reverse moves left or up
classNamestring-Additional classes. Set the color with text-*
styleCSSProperties-Inline styles