
Description
vue-word-highlighter is a Vue library that highlights search words inside a block of text. You pass the search words through the query prop and put the text in the default slot, and each match is wrapped in a highlight tag, which is mark by default. It works with Vue 2 and Vue 3, and Vue 2 support is provided through vue-demi. The query can be a string or a regular expression. Options control whether matching is case sensitive and whether diacritics matter. You can split the query by spaces so each word is searched on its own, and you can use exact matching so only whole words match, meaning a search for Java does not match JavaScript. The wrapper tag and its class can be changed, and classes and styles can be added to the highlight tag using the same array, object or string forms that Vue uses for bindings. The README has an installation section for each Vue version, a usage example and a props table that lists which fields are required and their defaults. A demo and a CodeSandbox example are linked. The source is public on GitHub.…
Highlights
- Highlights search words in text
- Works with Vue 2 and Vue 3
- String or regular expression queries
- Case and diacritics options
- Whole word matching
- Custom tags, classes and styles
Ratings & Reviews
No ratings yet
Be the first to rate vue-word-highlighter.
People also visit
vue-word-highlighter FAQ
What does vue-word-highlighter do?
It wraps matching search words in a highlight tag inside a block of text.
Which Vue versions does it support?
Vue 2 and Vue 3. The README gives separate install commands for each.
Can it match whole words only?
Yes. Setting matchMode to exact matches whole words, so Java does not match JavaScript.
Can I use a regular expression?
Yes. The query prop accepts a RegExp as well as a string.
What are the best vue-word-highlighter alternatives?
Popular alternatives to vue-word-highlighter include vue-scrollactive, vue3-simple-typeahead and vue-3-slider-component. See all vue-word-highlighter alternatives

















