Highlighted Text

Text with sliding background highlight animation using mix-blend-mode.

motion-sv
You  can just  ship things.

Installation

pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/s/highlighted-text.json

Usage

<script lang="ts">	import { HighlightedText } from "#lib/components/spell/highlighted-text/index.js";</script>
<HighlightedText>Important</HighlightedText>

Examples

Direction And View Trigger

Change the sweep origin and wait for viewport entry when you want the emphasis to arrive with surrounding content.

From Left
From Right
From Top
From Bottom

Props

NameTypeDefaultDescription
childrenSnippet | undefinedrequiredThe inline text content wrapped by the animated highlight.
from"left" | "right" | "top" | "bottom""bottom"Controls the direction the highlight bar sweeps in from.
delaynumber0Adds a delay in seconds before the highlight motion begins.
triggerOnViewbooleanfalseWaits to animate until the component enters the viewport.
oncebooleantrueWhen using triggerOnView, controls whether the animation runs only on first entry.
classClassValueCustom classes applied to the outer inline wrapper.