Divider

introduce

Used to separate content into multiple areas.

Code Demo

Basic usage

A horizontal dividing line is rendered by default.

<z-divider />

Display text

Insert content in the middle of separable lines through slots.

<z-divider>Text</z-divider>

Content location

Specify the location of the content through content-position.

<z-divider content-position="left">Text</z-divider>
<z-divider content-position="right">text</z-divider>

dashed line

Add the dashed attribute to render the split line as a dashed line.

<z-divider dashed>text</z-divider>

Custom style

The style of the dividing line can be set directly through the style attribute.

<z-divider
   :custom-style="{
     borderColor: '#1989fa',
     color: '#1989fa',
     padding: '0 32rpx'
   }"
>
   Word
</z-divider>

vertical

<div class="content">
   <z-divider vertical />
   Word
   <z-divider vertical dashed />
   Word
   <z-divider vertical :hairline="false" />
   Word
   <z-divider vertical :custom-style="{ borderColor: '#1989fa' }" />
</div>

API

Props

ParametersDescriptionTypeDefault value
dashedWhether to use dashed linesbooleanfalse
hairlineWhether to use 0.5px linebooleantrue
content-positionContent position, optional values are left rightstringcenter
verticalWhether to use verticalbooleanfalse

Slots

NameDescription
defaultcontent

Theme customization

Style variables

The component provides the following CSS variables, which can be used to customize styles. For usage, please refer to ConfigProvider component.

NameDefaultDescription
--z-divider-marginvar(--z-padding-md) 0-
--z-divider-vertical-margin0 var(--z-padding-xs)-
--z-divider-text-colorvar(--z-text-color-2)-
--z-divider-font-sizevar(--z-font-size-md)-
--z-divider-line-height48rpx-
--z-divider-border-colorvar(--z-border-color)-
--z-divider-content-paddingvar(--z-padding-md)-
--z-divider-content-left-width10%-
--z-divider-content-right-width10%-