Skip to Content
OWL data_display

Highlight Text

Odoo 19 OWL component — Highlight Text (webclient)

Live preview Interactive
Source excerpt web/static/src/webclient/settings_form_view/highlight_text/highlight_text.js
import { Component, useState, onWillRender } from "@odoo/owl";
import { highlightText } from "@web/core/utils/html";

export class HighlightText extends Component {
    static template = "web.HighlightText";
    static props = {
        originalText: String,
    };
    setup() {
        this.searchState = useState(this.env.searchState);

        onWillRender(() => {
            this.text = highlightText(
                this.searchState.value,
                this.props.originalText,
                "highlighter"
            );
        });
    }
}
Registry / API
Registry name
HighlightText
Category
Module
web
Slug
highlight-text
Nav group
data_display