Overview
The Separator component divides content either horizontally or vertically. It supports labels, icons, and avatars in the middle, making it perfect for section breaks, content divisions, and visual organization.
Usage
Use the Separator component as-is to create a simple horizontal divider:
< template >
< div >
< p > Content above </ p >
< USeparator />
< p > Content below </ p >
</ div >
</ template >
With label
< template >
< USeparator label = "OR" />
</ template >
With icon
< template >
< USeparator icon = "i-simple-icons-nuxtdotjs" />
</ template >
With avatar
< template >
< USeparator : avatar = " { src: 'https://github.com/nuxt.png' } " />
</ template >
Props
as
string | Component
default: "'div'"
The element or component this component should render as.
Display a text label in the middle of the separator.
Display an icon in the middle of the separator. Accepts Iconify icon names.
Display an avatar in the middle of the separator. Alternative text for the avatar image.
color
string
default: "'neutral'"
The color of the separator. Accepts theme color names (e.g., ‘primary’, ‘secondary’, ‘neutral’).
size
'xs' | 'sm' | 'md' | 'lg' | 'xl'
default: "'xs'"
The thickness of the separator line.
xs : 1px border
sm : 2px border
md : 3px border
lg : 4px border
xl : 5px border
type
'solid' | 'dashed' | 'dotted'
default: "'solid'"
The style of the separator line.
orientation
'horizontal' | 'vertical'
default: "'horizontal'"
The orientation of the separator.
When true, the separator is treated as decorative and hidden from screen readers.
Additional CSS classes to apply to the separator root element.
Override the default styling for specific separator slots. Custom classes for the separator root element.
Custom classes for the border/line elements.
Custom classes for the content container (label/icon/avatar).
Custom classes for the label text.
Custom classes for the icon.
Custom classes for the avatar.
Override the default avatar size.
Slots
Custom content to display in the middle of the separator. Receives ui object as a prop for styling. When using the default slot, the label, icon, and avatar props are ignored.
Orientation
Default horizontal separator: < template >
< div class = "space-y-4" >
< p > Section 1 </ p >
< USeparator />
< p > Section 2 </ p >
</ div >
</ template >
Vertical separator for side-by-side content: < template >
< div class = "flex items-center gap-4" >
< p > Left content </ p >
< USeparator orientation = "vertical" class = "h-20" />
< p > Right content </ p >
</ div >
</ template >
For vertical separators, you need to set a height using the class prop.
Colors
Default neutral color: < template >
< USeparator color = "neutral" />
</ template >
Primary theme color: < template >
< USeparator color = "primary" type = "solid" />
</ template >
Use any color from your theme: < template >
< USeparator color = "red" />
</ template >
Line styles
Default solid line: < template >
< USeparator type = "solid" />
</ template >
Dashed line style: < template >
< USeparator type = "dashed" />
</ template >
Dotted line style: < template >
< USeparator type = "dotted" />
</ template >
Sizes
< template >
< div class = "space-y-4" >
< USeparator size = "xs" />
< USeparator size = "sm" />
< USeparator size = "md" />
< USeparator size = "lg" />
< USeparator size = "xl" />
</ div >
</ template >
Theming
The Separator component uses the following theme structure:
{
slots : {
root : 'flex items-center align-center text-center' ,
border : '' ,
container : 'font-medium text-default flex' ,
icon : 'shrink-0 size-5' ,
avatar : 'shrink-0' ,
avatarSize : '2xs' ,
label : 'text-sm'
},
variants : {
color : {
neutral : { border : 'border-default' },
// + theme colors (primary, secondary, etc.)
},
orientation : {
horizontal : {
root : 'w-full flex-row' ,
border : 'w-full' ,
container : 'mx-3 whitespace-nowrap'
},
vertical : {
root : 'h-full flex-col' ,
border : 'h-full' ,
container : 'my-2'
}
},
size : {
xs : { border : 'border-t' }, // 1px
sm : { border : 'border-t-[2px]' },
md : { border : 'border-t-[3px]' },
lg : { border : 'border-t-[4px]' },
xl : { border : 'border-t-[5px]' }
},
type : {
solid : { border : 'border-solid' },
dashed : { border : 'border-dashed' },
dotted : { border : 'border-dotted' }
}
},
defaultVariants : {
color : 'neutral' ,
size : 'xs' ,
type : 'solid'
}
}
Examples
< template >
< form class = "space-y-6" >
< div >
< h3 class = "text-lg font-semibold" > Personal Information </ h3 >
<!-- form fields -->
</ div >
< USeparator label = "Account Settings" />
< div >
<!-- more form fields -->
</ div >
</ form >
</ template >
Login options separator
< template >
< div class = "space-y-4" >
< button class = "w-full" > Continue with Google </ button >
< button class = "w-full" > Continue with GitHub </ button >
< USeparator label = "OR" />
< form >
< input type = "email" placeholder = "Email" />
< input type = "password" placeholder = "Password" />
< button type = "submit" > Sign in </ button >
</ form >
</ div >
</ template >
< template >
< nav class = "space-y-2" >
< a href = "/" > Home </ a >
< a href = "/about" > About </ a >
< USeparator class = "my-4" />
< a href = "/settings" > Settings </ a >
< a href = "/logout" > Logout </ a >
</ nav >
</ template >
Custom slot content
< template >
< USeparator >
< template # default = " { ui } " >
< div : class = " ui . container () " >
< span class = "text-xs uppercase tracking-wide text-gray-500" >
Chapter 2
</ span >
</ div >
</ template >
</ USeparator >
</ template >
< template >
< div class = "flex items-center gap-2 p-2 border rounded" >
< button > Bold </ button >
< button > Italic </ button >
< button > Underline </ button >
< USeparator orientation = "vertical" class = "h-6" />
< button > Link </ button >
< button > Image </ button >
</ div >
</ template >
Customization
Global theme
Per instance
Customize separators globally via app.config.ts: export default defineAppConfig ({
ui: {
separator: {
slots: {
label: 'text-xs uppercase tracking-wider' ,
container: 'px-4'
},
defaultVariants: {
size: 'sm' ,
color: 'primary'
}
}
}
})
Override styling for a specific separator: < template >
< USeparator
: ui = " {
border: 'border-blue-500' ,
label: 'text-blue-600 font-bold'
} "
label = "Important Section"
/>
</ template >
Accessibility
The Separator component is based on Reka UI’s Separator primitive and follows WAI-ARIA separator pattern.
Use the decorative prop for purely visual separators that don’t convey meaningful content structure. This hides the separator from screen readers.
< template >
<!-- Decorative separator -->
< USeparator decorative />
<!-- Semantic separator (announces to screen readers) -->
< USeparator />
</ template >