Basic · Divider

Divider

Divider is a linear, lightweight component used to logically organize element content and page structure or areas.

Demos

How to import

<script setup lang="ts">
    import { Divider } from '@fibrous/semi-ui-vue';
</script>

Basic Usage

水平实线

Semi Design 是一个设计系统。它定义了一套中后台设计与前端基础组件。

水平虚线

Semi Design 是一个设计系统。它定义了一套中后台设计与前端基础组件。

垂直实线

左中右

垂直虚线

左中右
Code
<script setup lang="ts">
    import { Divider } from '@fibrous/semi-ui-vue';
</script>

<template>
    <div>
        <h3>水平实线</h3>
        <span>Semi Design 是一个设计系统。</span>
        <Divider margin="12px" />
        <span>它定义了一套中后台设计与前端基础组件。</span>

        <h3 :style="{ marginTop: '40px' }">水平虚线</h3>
        <span>Semi Design 是一个设计系统。</span>
        <Divider dashed margin="12px" />
        <span>它定义了一套中后台设计与前端基础组件。</span>

        <h3 :style="{ marginTop: '40px' }">垂直实线</h3>

        <div>
            <span>左</span>
            <Divider layout="vertical" margin="12px" />
            <span>中</span>
            <Divider layout="vertical" margin="12px" />
            <span>右</span>
        </div>

        <h3 :style="{ marginTop: '40px' }">垂直虚线</h3>
        <div>
            <span>左</span>
            <Divider dashed layout="vertical" margin="12px" />
            <span>中</span>
            <Divider dashed layout="vertical" margin="12px" />
            <span>右</span>
        </div>
    </div>
</template>

With Children

The content of a horizontal divider is passed through the default slot; a vertical divider shows no content.

这是居左文字
这是居中文字
这是居右文字
Code
<script setup lang="ts">
    import { IconSemiLogo } from '@fibrous/semi-icons-vue';
    import { Divider } from '@fibrous/semi-ui-vue';
</script>

<template>
    <div>
        <Divider align="left" margin="12px">这是居左文字</Divider>

        <Divider align="center" margin="12px">这是居中文字</Divider>

        <Divider align="right" margin="12px">这是居右文字</Divider>

        <Divider margin="12px">
            <IconSemiLogo />
        </Divider>
    </div>
</template>

API Reference

Props

PropertyDescriptionTypeDefault
alignAlignment of the content: left, center or right."left" | "right" | "center"semiDefault("Divider", "align", "center")
marginMargin above and below the divider, or left and right when vertical. A number is in pixels.string | numbersemiGlobalDefault("Divider", "margin")
dashedWhether the line is dashed.booleansemiGlobalDefault("Divider", "dashed")
layoutDirection of the divider: horizontal or vertical."vertical" | "horizontal"semiDefault("Divider", "layout", "horizontal")

Events

EventDescriptionCallback parameters
None

Slots

SlotDescriptionScope parameters
defaultContent of a horizontal divider. A vertical divider shows no content.any

Exposes

NameDescriptionType
None

class, style and native attributes passed as attrs land on the root element; the default separator role can be overridden with role.

Design Tokens

These are the component's internal Sass variables and cannot be overridden. To customize styles, override the --semi-* CSS variables (see the Design Token page) or write unlayered CSS rules.
Sass variableValueUsage
$spacing-divider_horizontal-marginLeft0px水平模式左间距
$spacing-divider_horizontal-marginRight0px水平模式右间距
$spacing-divider_horizontal-marginTop1px水平模式上间距
$spacing-divider_horizontal-marginBottom1px水平模式下间距
$spacing-divider_vertical-marginLeft1px垂直模式左间距
$spacing-divider_vertical-marginRight1px垂直模式右间距
$spacing-divider_vertical-marginTop0px垂直模式上间距
$spacing-divider_vertical-marginBottom0px垂直模式下间距
$spacing-divider_inner_text-paddingLeft8px内容为纯文字时内容左间距
$spacing-divider_inner_text-paddingRight8px内容为纯文字时内容右间距
$spacing-divider_inner_text-paddingTop0px内容为纯文字时内容上间距
$spacing-divider_inner_text-paddingBottom0px内容为纯文字时内容下间距
$width-divider_inner_text_left_line40px左对齐文字时左间距宽度
$width-divider_inner_text_right_line40px右对齐文字时右间距宽度
$width-divider-border1px分割线宽度
$height-divider_vertical20px垂直分割线高度
$color-divider_border-colorvar(--semi-color-border)分割线颜色
$color-divider_text-defaultvar(--semi-color-text-0)标题颜色
$font-divider_text-weight$font-weight-bold分割线文字字重