# Text

Typographic text: levels (h1~h6 / p / caption), semantic colors and boolean modifiers, multi-line ellipsis, and a copy button. The level decides the rendered tag (caption renders as a span for inline small text).

Text
<template>
  <div class="demo-col" style="gap: 18px; max-width: 640px">
    <div class="demo-row" style="gap: 16px; flex-wrap: wrap; align-items: baseline">
      <LhText level="h1">Heading 1</LhText>
      <LhText level="h3">Heading 3</LhText>
      <LhText level="caption">Helper small text</LhText>
    </div>
    <div class="demo-row" style="gap: 16px; flex-wrap: wrap; align-items: baseline">
      <LhText type="secondary">Secondary text</LhText>
      <LhText type="success">Success</LhText>
      <LhText type="warning">Warning</LhText>
      <LhText type="danger">Danger</LhText>
    </div>
    <div class="demo-row" style="gap: 16px; flex-wrap: wrap; align-items: baseline">
      <LhText strong>Bold</LhText>
      <LhText italic>Italic</LhText>
      <LhText underline>Underline</LhText>
      <LhText mark>Marked highlight</LhText>
      <LhText code>code</LhText>
      <LhText disabled>Disabled</LhText>
    </div>
    <div class="demo-row" style="flex-direction: column; gap: 8px; align-items: stretch">
      <LhText :ellipsis="2">
        Multi-line ellipsis: ink painting speaks of "five tones of ink" — on a sheet of rice paper, scorched, dense, heavy, light, and pale layers wash into one another; mountains have bones, water has rhythm, and the untouched white is itself part of the painting. When this passage exceeds two lines it is cut off and ends with an ellipsis.
      </LhText>
      <LhText copyable>Tap the button on the right to copy this text</LhText>
    </div>
  </div>
</template>

<script>
export default {
  data: () => ({}),
}
</script>

# Props

Prop Description Type Default
level Heading level and paragraph form: h1~h6 headings, p body text, caption inline small text 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'p' \| 'caption' 'p'
type Semantic color: default regular, secondary muted, the rest are status colors 'default' \| 'secondary' \| 'success' \| 'warning' \| 'danger' 'default'
strong / italic / underline / mark / code Bold / italic / underline / marked highlight / code style boolean false
ellipsis Ellipsis: true for a single line, a number truncates by line count (max 10) boolean \| number false
copyable Appends a copy button that writes to the clipboard and briefly flips to "Copied" boolean false
copyLabel Accessibility name of the copy button (falls back to the locale messages text.copy / text.copied when not passed) string —
disabled Disabled: text is grayed out and not copied boolean false
tag Custom rendered tag (follows level by default) string —
sx sx shorthand layout props — —

# Events

Event Description Callback args
copy Emitted when the copy button is clicked (text: string)

# Slots

Slot Description
default Text content (its textContent is used when copying)

# Accessibility

  • When copyable, an aria-labelledby associates the copy button so the text becomes part of the accessible name
Last Updated: 12/4/2026, 12:49:57 AM

Copyright © 2024-2026 FengMo WenXue