Display
Highlight
A marker-pen highlight for a phrase, with an optional animated sweep that renders its final state under reduced motion.
<script>
import { Highlight } from "@codeatlasdev/ui";
</script>
<h1>Ship <Highlight animated>faster</Highlight>.</h1>
Highlight renders a native <mark> painted as a marker stroke across the lower half of the line. With animated the marker sweeps in once on mount with --ca-ease-out-expo. Under prefers-reduced-motion: reduce, or --ca-motion-scale: 0, there is no animation and the marker is drawn complete. The color is --ca-highlight-color (a brand tint by default); under forced colors it uses the system Mark color. It wraps across lines without breaking.
Animated and static
Ship editorial pages without a line of local CSS, and keep static marks where motion would distract.
Reference #541 · Pick in the gallery
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
animated | boolean | false | Sweep the marker in on mount. Final state under reduced motion. |
class | string | '' | Extra classes on the `<mark>` element. |
children | Snippet | – | The highlighted text. |