Separator

Visually divide content sections

Import

import { Separator } from '@heroui/react';

Usage

HeroUI v3 Components

Beautiful, fast and modern React UI library.

Blog
Docs
Source
"use client";

import {Separator} from "@heroui/react";

export function Basic() {
  return (
    <div className="max-w-md">
      <div className="space-y-1">
        <h4 className="text-medium font-medium">HeroUI v3 Components</h4>
        <p className="text-small text-default-400">Beautiful, fast and modern React UI library.</p>
      </div>
      <Separator className="my-4" />
      <div className="text-small flex h-5 items-center space-x-4">
        <div>Blog</div>
        <Separator orientation="vertical" />
        <div>Docs</div>
        <Separator orientation="vertical" />
        <div>Source</div>
      </div>
    </div>
  );
}

Vertical

Blog
Docs
Source
"use client";

import {Separator} from "@heroui/react";

export function Vertical() {
  return (
    <div className="text-small flex h-5 items-center space-x-4">
      <div>Blog</div>
      <Separator orientation="vertical" />
      <div>Docs</div>
      <Separator orientation="vertical" />
      <div>Source</div>
    </div>
  );
}

With Content

Set Up Notifications

Set Up Notifications

Receive account activity updates

Set up Browser Extension

Set up Browser Extension

Connect your browser to your account

Mint Collectible

Mint Collectible

Create your first collectible

"use client";

import {Separator} from "@heroui/react";

const items = [
  {
    iconUrl: "https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/3dicons/bell-small.png",
    subtitle: "Receive account activity updates",
    title: "Set Up Notifications",
  },
  {
    iconUrl: "https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/3dicons/compass-small.png",
    subtitle: "Connect your browser to your account",
    title: "Set up Browser Extension",
  },
  {
    iconUrl:
      "https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/3dicons/mint-collective-small.png",
    subtitle: "Create your first collectible",
    title: "Mint Collectible",
  },
];

export function WithContent() {
  return (
    <div className="max-w-md space-y-4">
      {items.map((item, index) => (
        <div key={index}>
          <div className="flex items-center gap-3">
            <img alt={item.title} className="size-12" src={item.iconUrl} />
            <div className="flex-1 space-y-0">
              <h4 className="text-small font-medium">{item.title}</h4>
              <p className="text-muted text-sm">{item.subtitle}</p>
            </div>
          </div>
          {index < items.length - 1 && <Separator className="my-4" />}
        </div>
      ))}
    </div>
  );
}

Styling

Passing Tailwind CSS classes

import {Separator} from '@heroui/react';

function CustomSeparator() {
  return (
    <Separator className="my-8 bg-gradient-to-r from-transparent via-default-500 to-transparent" />
  );
}

Customizing the component classes

To customize the Separator component classes, you can use the @layer components directive.
Learn more.

@layer components {
  .separator {
    @apply bg-accent h-[2px];
  }
  
  .separator--vertical {
    @apply bg-accent w-[2px];
  }
}

HeroUI follows the BEM methodology to ensure component variants and states are reusable and easy to customize.

CSS Classes

The Separator component uses these CSS classes (View source styles):

Base & Orientation Classes

  • .separator - Base separator styles with default horizontal orientation
  • .separator--horizontal - Horizontal orientation (full width, 1px height)
  • .separator--vertical - Vertical orientation (full height, 1px width)

API Reference

Separator Props

PropTypeDefaultDescription
orientation'horizontal' | 'vertical''horizontal'The orientation of the separator
classNamestring-Additional CSS classes