Back to Vuetify

Highlight

packages/docs/src/pages/en/components/highlights.md

4.1.61.6 KB
Original Source

Highlight

The v-highlight component marks matching substrings within a block of text.

<PageFeatures />

::: warning

This feature requires v4.1.0

:::

Installation

Labs components require manual import and registration with the Vuetify instance.

js
import { VHighlight } from 'vuetify/labs/VHighlight'

export default createVuetify({
  components: {
    VHighlight,
  },
})

Usage

<ExamplesUsage name="v-highlight" /> <PromotedEntry />

API

ComponentDescription
v-highlightPrimary component
<ApiInline hide-links />

Guide

Props

Query

Pass a string or array of strings to query to be marked. Multiple terms are matched independently and overlapping or adjacent ranges are merged.

<ExamplesExample file="v-highlight/prop-query" />

Matches

Pass pre-computed [start, end] index pairs to matches to skip the internal search step entirely. This is useful if you need to bind fuzzy-search algorithm that responds with matching ranges.

<ExamplesExample file="v-highlight/prop-matches" />

Mark class

Use mark-class to customize the mark styling with CSS classes.

<ExamplesExample file="v-highlight/props-mark-class" />

Misc

CSS variables

Override --v-highlight-background, --v-highlight-color, and --v-highlight-border-radius on any ancestor to restyle marks without touching the component.

<ExamplesExample file="v-highlight/misc-css-variables" />

Selection match

<ExamplesExample file="v-highlight/misc-selection-match" />