---
title: "Separator · UI SDK — StyleX Blocks"
description: "Horizontal and vertical rules in solid, dashed, and dotted weights."
url: "https://stylexblocks.com/components/ui-sdk/separator/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Separator

Horizontal and vertical rules in solid, dashed, and dotted weights.

- Behavior engine: UI SDK
- Also available for: [Ark UI](https://stylexblocks.com/components/ark-ui/separator.md), [Base UI](https://stylexblocks.com/components/base-ui/separator.md)
- Category: Layout
- Variants: solid, dashed, dotted
- Sizes: xs, sm, md
- Used in blocks: [AI Chat Conversation](https://stylexblocks.com/block/ui-sdk/ai-chat.md), [Analytics Dashboard](https://stylexblocks.com/block/ui-sdk/analytics-dashboard.md), [Canvas Editor](https://stylexblocks.com/block/ui-sdk/canvas-editor.md), [Card Grid](https://stylexblocks.com/block/ui-sdk/card-grid.md), [Checkout Form](https://stylexblocks.com/block/ui-sdk/checkout-form.md), [Checkout Wizard](https://stylexblocks.com/block/ui-sdk/checkout-wizard.md), [Classic Gallery](https://stylexblocks.com/block/ui-sdk/classic-gallery.md), [Collapsible Table](https://stylexblocks.com/block/ui-sdk/collapsible-table.md), [Comparison Table](https://stylexblocks.com/block/ui-sdk/comparison-table.md), [Contact Form](https://stylexblocks.com/block/ui-sdk/contact-form.md), [Course Detail](https://stylexblocks.com/block/ui-sdk/course-detail.md), [Data Dashboard](https://stylexblocks.com/block/ui-sdk/data-dashboard.md), [Documentation Catalog](https://stylexblocks.com/block/ui-sdk/documentation-catalog.md), [Documentation Design](https://stylexblocks.com/block/ui-sdk/documentation-design.md), [Documentation Technical](https://stylexblocks.com/block/ui-sdk/documentation-technical.md), [Executive Dashboard](https://stylexblocks.com/block/ui-sdk/executive-dashboard.md), [File Explorer](https://stylexblocks.com/block/ui-sdk/file-explorer.md), [Filterable Table](https://stylexblocks.com/block/ui-sdk/filterable-table.md), [Two-Column Form](https://stylexblocks.com/block/ui-sdk/form-two-column.md), [Form Wizard](https://stylexblocks.com/block/ui-sdk/form-wizard.md), [Dialog Wizard](https://stylexblocks.com/block/ui-sdk/form-wizard-dialog.md), [Inline Wizard](https://stylexblocks.com/block/ui-sdk/form-wizard-inline.md), [Vertical Wizard](https://stylexblocks.com/block/ui-sdk/form-wizard-vertical.md), [Funnel & Cohort Dashboard](https://stylexblocks.com/block/ui-sdk/funnel-cohort-dashboard.md), [Grouped Table](https://stylexblocks.com/block/ui-sdk/grouped-table.md), [IDE Workspace](https://stylexblocks.com/block/ui-sdk/ide.md), [Inbox Table](https://stylexblocks.com/block/ui-sdk/inbox-table.md), [Incident Console](https://stylexblocks.com/block/ui-sdk/incident-console.md), [Kanban Board](https://stylexblocks.com/block/ui-sdk/kanban-board.md), [Login Card](https://stylexblocks.com/block/ui-sdk/login-card.md), [Login Split](https://stylexblocks.com/block/ui-sdk/login-split.md), [Login SSO](https://stylexblocks.com/block/ui-sdk/login-sso.md), [Messaging Shell](https://stylexblocks.com/block/ui-sdk/messaging-shell.md), [Mixed Gallery](https://stylexblocks.com/block/ui-sdk/mixed-gallery.md), [Order Detail](https://stylexblocks.com/block/ui-sdk/order-detail.md), [Page Editor](https://stylexblocks.com/block/ui-sdk/page-editor.md), [Portfolio Dashboard](https://stylexblocks.com/block/ui-sdk/portfolio-dashboard.md), [Product Detail](https://stylexblocks.com/block/ui-sdk/product-detail.md), [Product Gallery](https://stylexblocks.com/block/ui-sdk/product-gallery.md), [Project Status Dashboard](https://stylexblocks.com/block/ui-sdk/project-status-dashboard.md), [Searchable Table](https://stylexblocks.com/block/ui-sdk/searchable-table.md), [Service Monitoring](https://stylexblocks.com/block/ui-sdk/service-monitoring.md), [Settings Dialog](https://stylexblocks.com/block/ui-sdk/settings-dialog.md), [Settings Form](https://stylexblocks.com/block/ui-sdk/settings-form.md), [Settings Panels](https://stylexblocks.com/block/ui-sdk/settings-panels.md), [Shell Nav](https://stylexblocks.com/block/ui-sdk/shell-nav.md), [Side Nav Shell](https://stylexblocks.com/block/ui-sdk/shell-side-nav.md), [Top Nav Shell](https://stylexblocks.com/block/ui-sdk/shell-top-nav.md), [Side Gallery](https://stylexblocks.com/block/ui-sdk/side-gallery.md), [Theme Showcase](https://stylexblocks.com/block/ui-sdk/theme-showcase.md), [Tree Table](https://stylexblocks.com/block/ui-sdk/tree-table.md), [Work Item Detail](https://stylexblocks.com/block/ui-sdk/work-item-detail.md)
- HTML page: https://stylexblocks.com/components/ui-sdk/separator/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init --style ui-sdk
```

Then add the item as source you own:

```sh
npx stylexblocks add separator
```

Equivalent: `npx shadcn add @stylexblocks/separator`. Registry item JSON: https://stylexblocks.com/r/ui-sdk/separator.json

## Usage

```tsx
import { Separator } from "#components/ui/ui-sdk/separator.tsx";

export function Example() {
  return (
    <>
      {/* variant, orientation, and size resolve through the StyleX recipe;
          UI SDK sets role="separator" and aria-orientation itself */}
      <Separator variant="solid" orientation="horizontal" size="sm" />

      {/* decorative: purely visual, hidden from assistive tech */}
      <Separator decorative variant="dashed" />
    </>
  );
}
```

## Source

`components/ui/ui-sdk/separator.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { Separator as UiSdkSeparator } from "@ui-sdk/react/separator";
import { createComponent } from "#lib/ui-sdk/create-component.tsx";
import { defineRecipe } from "#lib/recipe-props.ts";
import { semanticColors } from '@stylexblocks/ui/semantic-tokens/colors.stylex.ts'

const separatorStyles = stylex.create({
  base: {
    display: 'block',
    borderColor: semanticColors.border,
  },
})

const separatorVariants = stylex.create({
  solid: {
    borderStyle: 'solid',
  },
  dashed: {
    borderStyle: 'dashed',
  },
  dotted: {
    borderStyle: 'dotted',
  },
})

const separatorOrientations = stylex.create({
  vertical: {
    height: '100%',
    borderInlineStartWidth: 'var(--separator-thickness)',
  },
  horizontal: {
    width: '100%',
    borderTopWidth: 'var(--separator-thickness)',
  },
})

const separatorSizes = stylex.create({
  xs: {
    '--separator-thickness': '0.5px',
  },
  sm: {
    '--separator-thickness': '1px',
  },
  md: {
    '--separator-thickness': '2px',
  },
  lg: {
    '--separator-thickness': '3px',
  },
})

export type SeparatorVariant = keyof typeof separatorVariants

export type SeparatorOrientation = keyof typeof separatorOrientations

export type SeparatorSize = keyof typeof separatorSizes

/**
 * Separator — recipe and component colocated in one file. Variant,
 * orientation, and size props resolve mechanically from the axis maps and
 * surface as data-* attributes. Behavior comes from UI SDK's Separator: it
 * sets `role="separator"` and `aria-orientation` itself (pass `decorative`
 * for a purely visual line, `role="none"`). Composition via `render`.
 */
const separatorRecipe = defineRecipe({
  styles: separatorStyles,
  axes: {
    variant: separatorVariants,
    orientation: separatorOrientations,
    size: separatorSizes,
  },
  defaultVariants: { variant: "solid", orientation: "horizontal", size: "sm" },
});

// The recipe consumes `orientation` as an axis; hand the resolved value
// (surfaced as `data-orientation`) back to UI SDK so it sets
// `aria-orientation` to match.
function SeparatorPart(
  props: React.ComponentProps<typeof UiSdkSeparator> & {
    "data-orientation"?: "horizontal" | "vertical";
  },
) {
  return <UiSdkSeparator orientation={props["data-orientation"]} {...props} />;
}

export const Separator = createComponent(SeparatorPart, separatorRecipe, "Separator");

export type SeparatorProps = React.ComponentProps<typeof Separator>;
```
