Skip to content
Pebble Pro is here at $49 one timeSee what’s included ↗
Pebble
ComponentsDocsMCPPricing
⌕ Find a component↗Log in
All components 673

Categories

Core inputs & forms46Buttons & actions33Navigation36Overlays & feedback49Data display33Charts & data viz40Cards & layout43Marketing blocks38App shells & pages37AI interfaces40Text & typography effects33Backgrounds & visual effects38Motion & transitions32Numbers & counters32Media34E-commerce333D & interactive36Themed sets40
Start with the essentials.Installation guide ↗Connect your agent ↗
← All componentsText & typography effects

Shimmer Text

Text with a band of light that sweeps across it on a loop, for in-progress status lines.

Preview

Summarising the launch thread

Step 3 of 4

0:07
  1. Read 14 comments from Ines and Malik
  2. Grouped feedback into 3 themes
  3. Drafting a reply to Priya…
  4. Check tone and length

Building your weekly report

Syncing 1,204 of 3,180 files

Install

Add the editable source with the shadcn CLI. Your project also needs the shared theme tokens this component uses. Setup and requirements. The Pebble installer is not published yet.

npx shadcn@latest add https://pebbleui.com/r/shimmer-text.json

Props

PropTypeDefaultDescription
as"span" | "p" | "div""span"Element rendered.
durationnumber2Seconds per sweep.
spreadnumber20Width of the band, as a percentage of the gradient. Clamped to 0–33 so the loop has no jump.
childrenReactNode—Inline text or inline elements that inherit color.
Build notes
A text gradient moved behind the glyphs. The element gets `background-clip: text` and transparent text, and a `--shimmer-gradient` of five stops (muted, a color-mix shoulder, the tone's band colour, a shoulder, muted) with the bright band `spread`% wide. The background is 300% of the element's width, so the band starts and ends fully off the text and the loop restart is invisible. Motion animates `background-position` from `100% 0` to `0% 0`, eased in-out and repeating with a `pause` rest between sweeps. Reduced motion is handled in CSS (`motion-reduce:bg-none` plus the muted text color) rather than in JS, so server and client markup match and the text is readable before hydration.

**Pebble (2026-11-03).** Added `tone` and `pause`. `tone="ember"` paints the band with `--accent` for a live process (an agent running, a sync in flight) and is meant to be used sparingly; `ink` stays the default; the root carries `data-tone`. The gradient gained a soft shoulder on each side of the band (a 55% `color-mix` of band and muted at a quarter-spread from centre) so the band edges no longer read as a stripe. The sweep is now eased (`easeInOut`) with a `repeatDelay` of `pause` seconds, so it reads as light passing over the text rather than a conveyor belt. Reduced-motion handling is unchanged.

<!-- PEBBLE-LICENSE -->
View source

registry/text/shimmer-text/shimmer-text.tsx

"use client";

/* PEBBLE-LICENSE
Built by Pebble. Component: shimmer-text.

First-party license: MIT

The following first-party terms apply only to original Pebble material.

MIT License

Copyright (c) 2026 Praxys Solutions LLC (Pebble)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
END PEBBLE-LICENSE */

import * as React from "react";
import { motion } from "motion/react";

import { cn } from "@/lib/utils";

// Hydration-safe reduced motion: the server (and the hydration pass) render
// "no preference", then the real preference applies right after hydration.
const subscribeReduce = (onChange: () => void) => {
  const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
  mq.addEventListener("change", onChange);
  return () => mq.removeEventListener("change", onChange);
};
const getReduce = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const useReduceMotion = () => React.useSyncExternalStore(subscribeReduce, getReduce, () => false);

const elements = {
  span: motion.span,
  p: motion.p,
  div: motion.div,
} as const;

// The band colour per tone. Ink is the default; ember marks a live process
// (an agent running, a sync in flight) and should be used sparingly.
const bands = {
  ink: "var(--foreground)",
  ember: "var(--accent)",
} as const;

export type ShimmerTextProps = Omit<
  React.ComponentProps<"span">,
  "children" | "style" | "onAnimationStart" | "onDrag" | "onDragStart" | "onDragEnd"
> & {
  as?: keyof typeof elements;
  /** Seconds per sweep. */
  duration?: number;
  /** Width of the band, as a percentage of the gradient (0–33). */
  spread?: number;
  /** Seconds of rest between sweeps. */
  pause?: number;
  /** Colour of the band of light: ink (default) or the ember accent. */
  tone?: keyof typeof bands;
  children: React.ReactNode;
  style?: React.CSSProperties;
};

export function ShimmerText({
  as = "span",
  duration = 2,
  spread = 20,
  pause = 0.4,
  tone = "ink",
  className,
  style,
  children,
  ...props
}: ShimmerTextProps) {
  const reduceMotion = useReduceMotion();
  // The three elements take the same props here; narrow to one for typing.
  const Comp = elements[as] as typeof motion.span;
  // Past 33% the band would already overlap the text on the first frame and
  // jump at each loop restart.
  const half = Math.min(Math.max(Number.isFinite(spread) ? spread : 20, 0), 33) / 2;
  const rest = Number.isFinite(pause) && pause > 0 ? pause : 0;
  const resolvedTone = Object.hasOwn(bands, tone) ? tone : "ink";
  const band = bands[resolvedTone];

  return (
    <Comp
      data-slot="shimmer-text"
      data-tone={resolvedTone}
      // Reduced motion is handled in CSS so server and client markup match:
      // the gradient is dropped and the text falls back to the muted colour.
      className={cn(
        as === "span" ? "inline-block" : "w-fit",
        "bg-[image:var(--shimmer-gradient)] bg-size-[300%_100%] bg-clip-text bg-no-repeat text-transparent",
        "motion-reduce:bg-none motion-reduce:text-muted-foreground",
        className,
      )}
      style={
        {
          // Three times the text width, so the band starts and ends fully off
          // the glyphs and the loop has no visible jump. A soft shoulder on
          // each side of the band keeps its edges from reading as a stripe.
          "--shimmer-gradient": `linear-gradient(90deg, var(--muted-foreground) ${50 - half}%, color-mix(in oklab, ${band} 55%, var(--muted-foreground)) ${50 - half / 2}%, ${band} 50%, color-mix(in oklab, ${band} 55%, var(--muted-foreground)) ${50 + half / 2}%, var(--muted-foreground) ${50 + half}%)`,
          backgroundPosition: "100% 0",
          ...style,
        } as React.CSSProperties
      }
      animate={reduceMotion ? undefined : { backgroundPosition: ["100% 0", "0% 0"] }}
      // Eased rather than linear, with a short rest between sweeps, so it
      // reads as light passing over the text rather than a conveyor belt.
      transition={{ duration, ease: "easeInOut", repeat: Infinity, repeatDelay: rest }}
      {...props}
    >
      {children}
    </Comp>
  );
}
Pebble

Small details.
Better interfaces.

React components to explore, make your own, and build on.

Library

  • Components
  • Installation
  • Pricing

Resources

  • For agents
  • About
  • Support

Legal

  • License
  • Terms
  • Privacy
  • Final sale

Built by Pebble

A product of Praxys Solutions LLC ↗

Pebble Pro is live

$49 one time, lifetime updates ↗