Skip to content

Line Component ​

This component is generally used to display a line for separating content blocks. It supports both horizontal and vertical modes, and can render 0.5px lines. It's also very simple to use.

📌 Platform Compatibility ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

🏯 Basic Usage Examples ​

html
<!-- Global usage -->
<hy-line></hy-line>

Custom Color ​

html
<template>
    <hy-line color="#2979ff"></hy-line>
</template>

Custom Line Direction ​

Tip

When setting the line to vertical, either the parent element must have a fixed width, or you need to set a value for length to resolve the issue of the line not being displayed

html
<template>
    <!--Vertical-->
    <hy-line direction="column" length="100"></hy-line>
    <!--Horizontal-->
    <hy-line direction="row"></hy-line>
</template>

Custom Line Length ​

html
<template>
    <hy-line length="50%"></hy-line>
</template>

Dashed Line ​

html
<template>
    <hy-line dashed color="red"></hy-line>
</template>

Line Thickness ​

html
<template>
    <!--Thin line-->
    <hy-line hairline></hy-line>
    <!--Thick line-->
    <hy-line :hairline="false"></hy-line>
</template>

API ​

Line Props ​

ParameterDescriptionTypeDefault Value
colorThe color of the linestring-
lengthLength, appears as height when vertical and as width when horizontal; can be a percentage, a value with rpx unit, etc.string|number100%
directionDirection of the line, row-horizontal, column-verticalrow|columnrow
hairlineWhether to display a thin linebooleantrue
marginThe spacing between the line and surrounding elements, in string form, such as "30rpx", "20rpx 30rpx"; default unit is pxstring0
dashedWhether to use a dashed line, false-solid line, true-dashed linebooleanfalse
customStyleCustom external styles to be appliedCSSProperties-
customClassCustom external class namestring-

CSS Variables ​

Variable NameDescriptionDefault Value
--hy-line-colorLine colorFollows --hy-border-color
12:33
battery