Highlight
Highlight matched keywords inside long text. Useful for search result lists and keyword markers.
Basic usage
text is the source text, match can be a string or a regex; string mode is case-insensitive by default.
ChuFix UI 是一个 Vue 3 与 React 双框架同源的基础组件库;CSS 变量主题、cf-* 类名前缀,纯 HTML/JS 项目也能直接用。
<CfHighlight :text="text" :match="q" /> <CfHighlight text={text} match={q} /> API
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | — | Source text |
match | string | RegExp | — | Keyword or regex; no highlight when empty |
caseSensitive | boolean | false | Whether to be case-sensitive in string mode |
反馈与讨论
Highlight · Discussion