---
title: Separator
description: A horizontal or vertical line that visually separates content, useful for creating visual hierarchy and grouping related items.
---
## Installation
CLI
Manual
```bash
npx lightswind@latest add separator
```
Copy and paste the following code into your project.
```tsx
import * as React from "react";
import { cn } from "@/components/lib/utils";
interface SeparatorProps extends React.HTMLAttributes {
/** The orientation of the separator */
orientation?: "horizontal" | "vertical";
/** Whether the separator is decorative or functional */
decorative?: boolean;
/** The thickness of the separator */
thickness?: "thin" | "default" | "thick";
/** The style of the separator */
lineStyle?: "solid" | "dashed" | "dotted";
/** The color variant of the separator */
variant?: "default" | "muted" | "accent" | "primary";
}
const Separator = React.forwardRef(
({
className,
orientation = "horizontal",
decorative = true,
thickness = "default",
lineStyle = "solid",
variant = "default",
...props
}, ref) => {
// Thickness classes
const thicknessClasses = {
thin: orientation === "horizontal" ? "h-px" : "w-px",
default: orientation === "horizontal" ? "h-[1px]" : "w-[1px]",
thick: orientation === "horizontal" ? "h-0.5" : "w-0.5"
};
// Style classes
const styleClasses = {
solid: "border-0",
dashed: lineStyle === "dashed" ? (orientation === "horizontal" ? "border-t-0 border-l-0 border-r-0 border-b border-dashed" : "border-t-0 border-b-0 border-r-0 border-l border-dashed") : "",
dotted: lineStyle === "dotted" ? (orientation === "horizontal" ? "border-t-0 border-l-0 border-r-0 border-b border-dotted" : "border-t-0 border-b-0 border-r-0 border-l border-dotted") : ""
};
// Variant classes
const variantClasses = {
default: "bg-primary/20",
muted: "bg-muted",
accent: "bg-accent",
primary: "bg-primary/20"
};
return (
);
}
);
Separator.displayName = "Separator";
export { Separator };
```
## Usage
```tsx
import { Separator } from '@/components/lightswind/separator';
```
```tsx
import { Separator } from '@/components/lightswind/separator';
export function SeparatorDemo() {
return (
Radix Primitives
An open-source UI component library.
);
}
```