Are you an LLM? You can read better optimized documentation at /components/text_highlight.md for this page in Markdown format
Text highlight ​
Stable
Highlights matching text inside a string.
vue
<script setup lang="ts">
import { HTextHighlight } from '@holistics/design-system'
</script>
<template>
<div>
<HTextHighlight
text="VERY Very very loooong longggg text"
highlights="very"
/>
</div>
</template>Examples ​
Case sensitive ​
Use caseSensitive prop to enable case-sentitive highlight:
vue
<script setup lang="ts">
import { HTextHighlight } from '@holistics/design-system'
</script>
<template>
<div>
<HTextHighlight
text="VERY Very very loooong longggg text"
highlights="very"
case-sensitive
/>
</div>
</template>Customization via slots ​
vue
<script setup lang="ts">
import { HTextHighlight } from '@holistics/design-system'
</script>
<template>
<div>
<HTextHighlight
text="VERY Very very loooong longggg text"
highlights="very"
>
<template #highlight="{ part }">
<span class="relative z-0 before:absolute before:inset-x-0 before:-bottom-1 before:-z-10 before:h-1 before:rounded before:bg-interactive-success-hover">{{ part }}</span>
</template>
</HTextHighlight>
</div>
</template>API ​
Pass-through: NO ​
Props ​
| Name | Type | Description |
|---|---|---|
text * | string | The original text. |
highlights | string | string[]= "" | The text(s) to highlight. |
caseSensitive | boolean | When |
Slots ​
| Name | Scoped | Description |
|---|---|---|
#highlight | { part: string; } | |
#text | { part: string; } |