Skip to content

witTooltip Smart Tooltip Component

witTooltip is a smart tooltip component based on Element Plus, used to automatically display tooltip when text content overflows. The component supports single-line and multi-line text overflow detection, and provides rich custom configuration options.

Usage Example

vue
<template>
  <div>
    <!-- Basic usage -->
    <witTooltip content="This is a basic tooltip example">
      This is text content that may overflow, if container width is insufficient, tooltip will be displayed
    </witTooltip>
    
    <!-- Multi-line text -->
    <witTooltip 
      content="This is a multi-line text tooltip example, supports custom display line count"
      :lines="2"
    >
      This is multi-line text content that may overflow, if container width or height is insufficient, tooltip will be displayed.
      Second line text for testing multi-line overflow detection.
    </witTooltip>
    
    <!-- Bold text -->
    <witTooltip 
      content="This is a bold text tooltip example"
      :bold="true"
    >
      This is bold text, if content overflows tooltip will be displayed
    </witTooltip>
    
    <!-- Custom theme -->
    <witTooltip 
      content="This is a custom theme tooltip example"
      effect="light"
    >
      This is text, tooltip will use light theme
    </witTooltip>
  </div>
</template>

<script lang="ts" setup>
// No additional import needed, component is globally registered
</script>

API

Component

Component NameDescription
witTooltipSmart tooltip main component

Properties

Property NameTypeDefault ValueDescription
contentString''Tooltip content
linesNumber1Number of lines to display
boldBooleanfalseWhether to use bold text
effectString'dark'Tooltip theme: 'dark' or 'light'

湘ICP备2024070110号