Separator
Visually or semantically separates content.
Radix Primitives
An open-source UI component library.
Blog
Docs
Source
import { css } from 'remix/component'
import { Separator } from '#app/ui/separator.tsx'
export function SeparatorDemo() {
return () => (import { css } from 'remix/component'
import { Separator } from '#app/ui/separator.tsx'
export function SeparatorDemo() {
return () => (
<div>
<div mix={css({ '& > :not(:last-child)': { marginBottom: '0.25rem' } })}>
<h4 mix={css({ fontSize: '0.875rem', lineHeight: 1, fontWeight: 500 })}>Radix Primitives</h4>
<p
mix={css({
fontSize: '0.875rem',
lineHeight: 'calc(1.25 / 0.875)',
color: 'var(--muted-foreground)',
})}
>
An open-source UI component library.
</p>
</div>
<Separator mix={css({ marginBlock: '1rem' })} />
<div
mix={css({
display: 'flex',
height: '1.25rem',
alignItems: 'center',
fontSize: '0.875rem',
lineHeight: 'calc(1.25 / 0.875)',
'& > :not(:last-child)': { marginInlineEnd: '1rem' },
})}
>
<div>Blog</div>
<Separator orientation="vertical" />
<div>Docs</div>
<Separator orientation="vertical" />
<div>Source</div>
</div>
</div>
)
}Installation
$ bunx --bun shadcn@latest add https://www.shadcn-remix.com/r/separator.json$ npx shadcn@latest add https://www.shadcn-remix.com/r/separator.json$ pnpm dlx shadcn@latest add https://www.shadcn-remix.com/r/separator.json$ yarn dlx shadcn@latest add https://www.shadcn-remix.com/r/separator.jsonInstall the following dependencies:
$ bun add remix$ npm install remix$ pnpm add remix$ yarn add remixCopy and paste the following code into your project.
import { css, type Handle, type Props } from 'remix/component'
export interface SeparatorProps extends Props<'div'> {
orientation?: 'horizontal' | 'vertical'
/**
* When `true` (default) the separator is purely visual (`role="none"`); when `false` it is
* exposed to assistive technology as `role="separator"`.
*/
decorative?: boolean
}
const separatorStyles = css({
flexShrink: 0,
backgroundColor: 'var(--border)',
'&[data-orientation="horizontal"]': { height: '1px', width: '100%' },
'&[data-orientation="vertical"]': { height: '100%', width: '1px' },
})
export function Separator(handle: Handle<SeparatorProps>) {
return () => {
let { orientation = 'horizontal', decorative = true, mix, ...props } = handle.props
return (
<div
data-slot="separator"
data-orientation={orientation}
role={decorative ? 'none' : 'separator'}
aria-orientation={!decorative && orientation === 'vertical' ? 'vertical' : undefined}
{...props}
mix={[separatorStyles, mix]}
/>
)
}
}Update the import paths to match your project setup.
Usage
import { Separator } from '#app/ui/separator.tsx'<Separator />API Reference
Separator
| Prop | Type | Default |
|---|---|---|
orientation | "horizontal" | "vertical" | "horizontal" |
decorative | boolean | true |
mix | MixValue | - |