Separator
patchui/separatorFreeComponent
patchui publishes no description for this item.
Install it
npx shadcn@latest add https://ui.hotfix.jobs/r/separator.jsonSource
1"use client";23import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";4import { mergeProps } from "@base-ui/react/merge-props";5import { useRender } from "@base-ui/react/use-render";6import type * as React from "react";7import { cn } from "@/lib/utils";89export interface SeparatorProps extends useRender.ComponentProps<"div"> {10 orientation?: React.ComponentProps<11 typeof SeparatorPrimitive12 >["orientation"];13 /** Optional inline label (horizontal only) for "OR"/"AND" split patterns. */14 label?: React.ReactNode;15 /** Hide the separator from screen readers. Defaults to true unless labeled. */16 decorative?: boolean;17}1819export function Separator({20 orientation = "horizontal",21 label,22 decorative,23 className,24 children,25 render,26 ...props27}: SeparatorProps): React.ReactElement {28 const hasLabel = Boolean(label && orientation === "horizontal");29 const isDecorative = decorative ?? !hasLabel;30 const defaultProps = {31 role: isDecorative ? "none" : "separator",32 "aria-orientation": orientation,33 "data-slot": "separator",34 "data-orientation": orientation,35 className: cn(36 hasLabel37 ? "flex w-full items-center gap-3 text-mini text-ink-muted"38 : "shrink-0 bg-hairline",39 !hasLabel &&40 (orientation === "horizontal" ? "h-px w-full" : "h-full w-px"),41 className,42 ),43 children: hasLabel ? (44 <>45 <span className="h-px flex-1 bg-hairline" aria-hidden />46 <span>{label}</span>47 <span className="h-px flex-1 bg-hairline" aria-hidden />48 </>49 ) : (50 children51 ),52 };5354 return useRender({55 defaultTagName: "div",56 render,57 props: mergeProps<"div">(props, defaultProps),58 });59}6061export { SeparatorPrimitive };
What it pulls in
npm packages
Other registry items
Files it writes
More from patchui
All 51 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | patchui | Components | Free | 2 deps | |
| Avataravatar | patchui | Components | Free | 3 deps | |
| Badgebadge | patchui | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | patchui | Components | Free | 1 dep | |
| Buttonbutton | patchui | Components | Free | 2 deps | |
| Calendarcalendar | patchui | Components | Free | 1 dep | |
| Cardcard | patchui | Components | Free | 1 dep | |
| Checkboxcheckbox | patchui | Components | Free | 2 deps |
