Text with a background that sweeps in from the left, like a highlighter.
Highlight Text
Installation
Usage
The highlight is the element's background: give it one with your own classes.
import { HighlightText } from '@animate-ui/react/primitives/texts/highlight';
export function Title() {
return (
<HighlightText
text="Highlight Text"
className="bg-linear-to-r from-blue-100 to-purple-100"
inView
/>
);
}Animation
- The background grows from the left edge over 2s on an ease-in-out: slow at first, fastest midway, easing into place.
- With
inViewOnce={false}, it resets off screen and sweeps again on the next entrance. <AnimateUIProvider tempo>paces the default duration.- Under reduced motion, the text is highlighted at once.
API Reference
HighlightText
| Prop | Type | Default |
|---|---|---|
text | string | - |
delay? | number | 0 |
transition? | Transition | { duration: 2, ease: 'easeInOut' } |
inView? | boolean | false |
inViewMargin? | string | '0px' |
inViewOnce? | boolean | true |
...props? | Omit<HTMLMotionProps<'span'>, 'children'> | - |