Skip to content

Divider ​

The Divider component renders a horizontal line to separate content in terminal apps. Customize the character, length, and color.

Basic Usage ​

vue
<template>
  <Divider />
</template>

<script setup>
import { Divider } from 'vuetty';
</script>

Props ​

NameTypeDefaultDescription
charstring'─'Character used to draw the divider
lengthnumber40Length of the divider in characters
colorstring-Text color (chalk color names)

Layout Props (Box Props) ​

NameTypeDefaultDescription
flexnumber | stringnullFlex shorthand when inside a flex container
flexGrownumbernullFlex grow factor
flexShrinknumbernullFlex shrink factor
flexBasisnumber | stringnullFlex basis
alignSelfstringnullSelf alignment: 'auto', 'flex-start', 'flex-end', 'center', 'stretch', 'baseline'
widthnumber | stringnullWidth (chars or %)
heightnumber | stringnullHeight (rows)
minWidthnumbernullMinimum width
maxWidthnumbernullMaximum width
minHeightnumbernullMinimum height
maxHeightnumbernullMaximum height
paddingnumbernullPadding
paddingLeftnumbernullLeft padding
paddingRightnumbernullRight padding
paddingTopnumbernullTop padding
paddingBottomnumbernullBottom padding
marginnumbernullMargin
marginLeftnumbernullLeft margin
marginRightnumbernullRight margin
marginTopnumbernullTop margin
marginBottomnumbernullBottom margin

Customization ​

Custom Character ​

vue
<template>
  <Divider char="=" />
</template>

<script setup>
import { Divider } from 'vuetty';
</script>

Custom Length ​

vue
<template>
  <Divider :length="20" />
</template>

<script setup>
import { Divider } from 'vuetty';
</script>

Custom Color ​

vue
<template>
  <Divider color="cyan" />
</template>

<script setup>
import { Divider } from 'vuetty';
</script>

Usage with Other Components ​

With Box ​

vue
<template>
  <Box :padding="1">
    <TextBox>Section 1</TextBox>
    <Divider />
    <TextBox>Section 2</TextBox>
  </Box>
</template>

<script setup>
import { Divider, Box, TextBox } from 'vuetty';
</script>

With Row and Col ​

vue
<template>
  <Col gap="1">
    <TextBox>Above Divider</TextBox>
    <Divider />
    <TextBox>Below Divider</TextBox>
  </Col>
</template>

<script setup>
import { Divider, Col, TextBox } from 'vuetty';
</script>

Released under the MIT License.