Skip to content
API 风格:

Divider ​

A separator line that visually divides content. With label text it carries grouping semantics (role="separator"); purely decorative variants are removed from the accessibility tree.

Basic Usage ​

Basic Usage
Content aboveContent below
vue
<script setup lang="ts">
</script>

<template>
  <LhDivider />
</template>
vue
<script>
export default {}
</script>

<template>
  <LhDivider />
</template>

Vertical Divider ​

Vertical
HomeListDetail
vue
<script setup lang="ts">
</script>

<template>
  <!-- Vertical -->
  <div>
    <span>Home</span>
    <LhDivider direction="vertical" />
    <span>List</span>
    <LhDivider direction="vertical" />
    <span>Detail</span>
  </div>
</template>
vue
<script>
export default {}
</script>

<template>
  <!-- Vertical -->
  <div>
    <span>Home</span>
    <LhDivider direction="vertical" />
    <span>List</span>
    <LhDivider direction="vertical" />
    <span>Detail</span>
  </div>
</template>

With Label ​

Labels work in both directions: align horizontally with label-position; vertical labels are always centred.

With Label
vue
<script setup lang="ts">
</script>

<template>
  <LhDivider label-position="left">Listening to the rain in a tower in youth</LhDivider>
  <LhDivider>Listening to the rain on a boat in middle age</LhDivider>
  <LhDivider label-position="right">Listening to the rain in a monk's hut now</LhDivider>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhDivider label-position="left">Listening to the rain in a tower in youth</LhDivider>
  <LhDivider>Listening to the rain on a boat in middle age</LhDivider>
  <LhDivider label-position="right">Listening to the rain in a monk's hut now</LhDivider>
</template>

Dashed ​

Dashed
vue
<script setup lang="ts">
</script>

<template>
  <LhDivider dashed />
  <LhDivider dashed>Dashed combines with labels</LhDivider>
  <LhDivider border-style="dotted">Custom border style (dotted)</LhDivider>
</template>
vue
<script>
export default {}
</script>

<template>
  <LhDivider dashed />
  <LhDivider dashed>Dashed combines with labels</LhDivider>
  <LhDivider border-style="dotted">Custom border style (dotted)</LhDivider>
</template>

API ​

Props ​

PropDescriptionTypeDefault
directionDivider direction"horizontal" | "vertical"'horizontal'
dashedDashed stylebooleanfalse
labelPositionLabel alignment (horizontal only; vertical labels are always centred)"left" | "center" | "right"'center'
borderStyleBorder style (e.g. 'dotted'), reservedstring—
sxShorthand layout props (e.g. { mt: 2, w: '50%' }), applied as inline styles on the root elementLhSxProps—

Slots ​

SlotDescriptionDefault
defaultDivider label text (left/right when horizontal, above/below when vertical)—

Accessibility ​

  • With label: role="separator" — a real grouping boundary for screen readers; vertical dividers also declare aria-orientation="vertical"
  • Decorative: role="presentation", removed from the accessibility tree
  • Not focusable, no keyboard interaction

Type Definitions ​

The TypeScript type structures exported by this component (auto-extracted from packages/components/divider/src/types.ts and @lh-ui/share/core/* sources; click each entry to expand; see the Props table above for attribute descriptions):

LhDividerProps
ts
export interface LhDividerProps {
  direction?: LhDividerDirection
  dashed?: boolean
  labelPosition?: LhDividerLabelPosition
  borderStyle?: string
  sx?: LhSxProps
}
LhDividerLabelPosition (from @lh-ui/share/core/divider)
ts
export type LhDividerLabelPosition = 'left' | 'center' | 'right'
LhDividerDirection (from @lh-ui/share/core/divider)
ts
export type LhDividerDirection = 'horizontal' | 'vertical'

Beauty of tradition, foundation of code