Installation
Install the component
Run the following command to install the component and its dependencies:
npx @motion-core/cli add split-revealnpx @motion-core/cli add split-revealpnpm dlx @motion-core/cli add split-revealpnpm dlx @motion-core/cli add split-revealbunx @motion-core/cli add split-revealbunx @motion-core/cli add split-revealyarn dlx @motion-core/cli add split-revealyarn dlx @motion-core/cli add split-revealImport the component
Import the component into your Svelte file:
import { SplitReveal } from "$lib/motion-core";import { SplitReveal } from "$lib/motion-core";Usage
We’re using GSAP’s SplitText to break this content into lines, words, and
individual characters. Experiment with staggered tweens, custom ease
functions, and dynamic transforms to bring your headlines to life.
Props
0.800s
0.080s
0.000s
<script lang="ts">
import { SplitReveal } from "motion-core";
import type { ComponentProps } from "svelte";
type SplitRevealProps = ComponentProps<typeof SplitReveal>;
type SplitMode = NonNullable<SplitRevealProps["mode"]>;
type Props = Partial<
Pick<SplitRevealProps, "mode" | "delay"> & {
duration: number;
stagger: number;
}
>;
let {
mode = "lines",
duration = 0.8,
stagger = 0.08,
delay = 0,
}: Props = $props();
const config = $derived({
[mode]: {
duration,
stagger,
},
});
</script>
{#key `${mode}-${duration}-${stagger}-${delay}`}
<SplitReveal
{mode}
{config}
{delay}
class="absolute top-1/2 left-1/2 block w-sm -translate-x-1/2 -translate-y-1/2 p-8 text-center text-lg md:w-3xl"
>
We’re using GSAP’s SplitText to break this content into lines, words, and
individual characters. Experiment with staggered tweens, custom ease
functions, and dynamic transforms to bring your headlines to life.
</SplitReveal>
{/key}
<script lang="ts">
import { SplitReveal } from "motion-core";
import type { ComponentProps } from "svelte";
type SplitRevealProps = ComponentProps<typeof SplitReveal>;
type SplitMode = NonNullable<SplitRevealProps["mode"]>;
type Props = Partial<
Pick<SplitRevealProps, "mode" | "delay"> & {
duration: number;
stagger: number;
}
>;
let {
mode = "lines",
duration = 0.8,
stagger = 0.08,
delay = 0,
}: Props = $props();
const config = $derived({
[mode]: {
duration,
stagger,
},
});
</script>
{#key `${mode}-${duration}-${stagger}-${delay}`}
<SplitReveal
{mode}
{config}
{delay}
class="absolute top-1/2 left-1/2 block w-sm -translate-x-1/2 -translate-y-1/2 p-8 text-center text-lg md:w-3xl"
>
We’re using GSAP’s SplitText to break this content into lines, words, and
individual characters. Experiment with staggered tweens, custom ease
functions, and dynamic transforms to bring your headlines to life.
</SplitReveal>
{/key}
Props
SplitReveal
| Prop | Type | Default |
|---|---|---|
mode | "lines""words""chars" | "lines" |
class | string | "" |
as | keyof HTMLElementTagNameMap | "div" |
config | SplitRevealConfig | DEFAULT_CONFIG |
delay | number | 0 |
triggerOnScroll | boolean | false |
scrollElement | stringHTMLElementnull | window |
SplitRevealConfig
| Key | Type | Default |
|---|---|---|
lines.duration | number | 0.8 |
lines.stagger | number | 0.08 |
words.duration | number | 0.6 |
words.stagger | number | 0.06 |
chars.duration | number | 0.4 |
chars.stagger | number | 0.008 |