Separator

Base

Visual divider for separating content sections.

Preview

ParamUI

An open-source component library.

Docs
Source
Blog

Usage

example.jsx
import { Separator } from "@/components/ui/separator";

export default function Example() {
  return <Separator />;
}

Source Code

Copy this file into components/ui/separator.jsx in your project.

separator.jsx
import { forwardRef } from "react";
import { cn } from "@/lib/utils";

const Separator = forwardRef(
  (
    { className, orientation = "horizontal", decorative = true, ...props },
    ref
  ) => (
    <div
      ref={ref}
      role={decorative ? "none" : "separator"}
      aria-orientation={!decorative ? orientation : undefined}
      className={cn(
        "shrink-0 bg-border",
        orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
        className
      )}
      {...props}
    />
  )
);
Separator.displayName = "Separator";

export { Separator };

Quick Install

Make sure you have the cn() utility set up. It requires clsx and tailwind-merge.

npm install clsx tailwind-merge