Component

Separator

A horizontal or vertical divider.

Doffy UI

A component registry built on shadcn/ui.

Docs
Source
Registry

Installation

npx shadcn@latest add @doffy/separator

Or, without the registry in components.json:

npx shadcn@latest add https://ui.doffy.com/r/separator.json

Usage

import { Separator } from "@/components/ui/separator"

export default function SeparatorDemo() {
  return (
    <div className="w-full max-w-xs text-xs">
      <p className="font-medium">Doffy UI</p>
      <p className="text-muted-foreground">A component registry built on shadcn/ui.</p>
      <Separator className="my-4" />
      <div className="flex h-4 items-center gap-4">
        <span>Docs</span>
        <Separator orientation="vertical" />
        <span>Source</span>
        <Separator orientation="vertical" />
        <span>Registry</span>
      </div>
    </div>
  )
}

Source

Show separator.tsx
"use client"

import * as React from "react"
import { cn } from "cn"
import { Separator as SeparatorPrimitive } from "radix-ui"

function Separator({
  className,
  orientation = "horizontal",
  decorative = true,
  ...props
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
  return (
    <SeparatorPrimitive.Root
      data-slot="separator"
      decorative={decorative}
      orientation={orientation}
      className={cn(
        "shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",
        className
      )}
      {...props}
    />
  )
}

export { Separator }