Skip to content

Divider

A divider line to separate content.

Basic Usage

Separate paragraphs of text in different sections.

Youth is a common name, it is happy and beautiful, but it is also full of hard training.

The white sun sets behind the mountain, the Yellow River flows into the sea. To see a thousand miles, go up another level.

If you don't work hard when you are young, you will be sorry when you are old.

Basic Usage

Custom Content

You can customize the text content on the divider line.

Rain falls in the old hometown, the grass and trees are deep, I heard you still guard the lonely city.

The sound of the shepherd's flute in the suburbs, falling in that wild village.

Fate takes root and sprouts in us.

Listening to the rain at Jialan Temple, looking forward to eternity.

Custom Content

Vertical Divider

Use direction="vertical" to create a vertical divider.

RainFallsDeep
Vertical Divider

Dashed Line

Set border-style="dashed" to present a dashed line.

Content Area

Content Area

Content Area

Dashed Line

Custom Color and Thickness

Use color and border-width attributes to customize the color and thickness of the divider.

Default Style

Custom Color

Custom Thickness (2px)

Thick Line + Dashed

Custom Divider with Text

Custom Color and Thickness

Use in Nuxt

The Divider component fully supports Nuxt 3/4 environments. As a purely presentational component, its HTML structure is generated directly on the server, achieving perfect visual separation on the first screen with inline or external stylesheets.

YH-UI runs extremely smoothly in Nuxt.

Component 1Component 2Component 3
Use in Nuxt

SSR Notes:

  • ✅ Horizontal and vertical directions are generated correctly on the server.
  • ✅ Content position is correctly positioned during the SSR phase.
  • ✅ Dashed/dotted styles and custom thickness take effect on the server via styles.
  • ✅ Auto-import feature makes the development experience more pleasant.

Performance Tip

Since the Divider component has a minimalist structure, it generates almost no extra JS payload in SSR scenarios, making it ideal for content-heavy Nuxt pages that prioritize loading speed.

API

Props

PropDescriptionTypeDefault
directionDivider direction'horizontal' | 'vertical''horizontal'
content-positionContent position'left' | 'center' | 'right''center'
border-styleDivider border style'solid' | 'dashed' | 'dotted' | 'double''solid'
border-widthDivider border widthstring | number1px
colorDivider colorstring

Slots

Slot NameDescription
defaultContent text of the divider

Theme Variables

VariableDescriptionDefault
--yh-divider-border-colorDivider border colorvar(--yh-border-color-lighter)
--yh-divider-border-widthDivider border width1px
--yh-divider-border-styleDivider border stylesolid
--yh-divider-margin-horizontalHorizontal margin24px 0
--yh-divider-margin-verticalVertical margin0 8px
--yh-divider-text-colorContent text colorvar(--yh-text-color-primary)

Released under the MIT License.