Highlight
@stellaria/nebula-webHighlightPropsPreview
Props
8| Prop | Type | Default |
|---|---|---|
children Plain text, not nodes: the component splits this string to wrap the matches, so anything with markup in it would be torn apart. That is why the type narrows here and why formatting inside the highlighted text is not possible. | string | — |
className Composes with the classes `Box` computes instead of replacing them. | string | — |
color Passed on to the `mark` around every match. It tints the matches only — the rest of the text keeps the colour it inherits. | ColorExtended | "warning" |
component The element wrapping the whole run of text; the matches themselves are always `mark`. | (ElementType & C) | "p" |
highlight requiredWhat to mark. Matching is case-insensitive and lands anywhere, including inside a word, so a short term marks more than you expect. Regex characters are escaped, which makes a raw search box safe to pipe in here; empty strings are dropped, and an empty array marks nothing. | string | string[] | — |
inherit Takes family, size, weight and line height from the parent instead of the `Text` defaults. For text that must sit inside a heading or a button without breaking its type. | boolean | — |
lines Clamps the text to this many lines with an ellipsis. Beats `truncate`, and only applies above zero. Needs a width to work against: inside a flex child, that usually means `miw={0}`. | number | — |
truncate Cuts the text to a single line with an ellipsis. Ignored when `lines` is set, which does the same thing over several lines. The full text stays in the DOM, so it is still read aloud. | boolean | — |
Also accepts
On top of its own props, this component forwards these groups.