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
Feature
Baseline
Your browser
Masks
Creates the dashed line
Your browser:
Preview
Dashed divider with faded ends and moving dashes
Installation
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.
- Request
- Review
- 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
| Prop | Type | Default | Description |
|---|---|---|---|
| orientation | "horizontal" | "vertical" | "horizontal" | Line direction |
| dash | number | 6 | Dash length, in px |
| gap | number | 4 | Gap between dashes, in px |
| thickness | number | 1 | Line thickness, in px |
| fade | number | 15 | Fade at each end, in percent of the length. 0 turns it off |
| animated | boolean | false | Move the dashes along the line |
| speed | number | 20 | Dash speed, in px per second |
| direction | "forward" | "reverse" | "forward" | forward moves right or down, reverse moves left or up |
| className | string | - | Additional classes. Set the color with text-* |
| style | CSSProperties | - | Inline styles |