Skip to main content

Sheen Text

Luminous background-clip light sweep built strictly from semantic OKLCH and OKLAB color tokens, with tempo cycles and pointer-tracked angles.

Light catches the surface

Customize

Band width (%)28
Cycle (ms)2400

Installation

npx shadcn@latest add @kinetic/sheen-text

Usage

Pass a string via text or inline markup via children. SheenText clips a multi-stop linear gradient to the glyphs with background-clip: text using only semantic CSS color tokens mixed in OKLAB and OKLCH (--foreground, --muted-foreground, and --primary), so contrast stays legible across light, dark, and custom accent themes without hard-coded colors.

import { SheenText } from "@/components/kinetic/ui/sheen-text";

interface FeatureBadgeProps {
  readonly label: string;
}

export function FeatureBadge({ label }: FeatureBadgeProps) {
  return (
    <SheenText
      as="span"
      text={label}
      className="text-sm font-medium tracking-wide"
    />
  );
}

Modes, tones, and pointer angle tracking

Control how the highlight moves with mode:

  • "auto" (default): sweeps continuously on global tempo while idle (unless paused is true), then switches smoothly to pointer-tracked band position and tilt angle on fine-pointer hover, resuming the tempo cycle from the current position when the pointer leaves.
  • "tempo": runs strictly on the timed sweep cycle without reacting to hover.
  • "pointer": stays quiet at rest and glides the highlight band and gradient angle dynamically with the pointer while hovered.

Choose between tone="foreground" (neutral sheen peaking at --foreground) and tone="primary" (accent sheen blending --primary and --foreground in OKLCH). Customize the beam with angleDeg (default 115, clamped 0 to 360), bandWidth (default 28, clamped 10 to 60), durationMs (default 2400, clamped 300 to 12000), and speed (default 1).

import {
  SheenText,
  type SheenTextMode,
  type SheenTextTone,
} from "@/components/kinetic/ui/sheen-text";

interface HeroKickerProps {
  readonly label: string;
  readonly mode: SheenTextMode;
  readonly tone: SheenTextTone;
  readonly paused: boolean;
}

export function HeroKicker({ label, mode, tone, paused }: HeroKickerProps) {
  return (
    <SheenText
      as="h2"
      mode={mode}
      tone={tone}
      paused={paused}
      angleDeg={120}
      bandWidth={32}
      durationMs={2200}
      className="text-3xl font-semibold tracking-tight"
    >
      {label}
    </SheenText>
  );
}

Imperative control

Attach a SheenTextHandle ref and call sweep() to fire a single full light sweep on demand, including when mode="pointer" or paused={true}.

"use client";

import { useRef } from "react";
import {
  SheenText,
  type SheenTextHandle,
} from "@/components/kinetic/ui/sheen-text";

export function ControlledSheen() {
  const sheenRef = useRef<SheenTextHandle>(null);

  return (
    <div className="flex flex-col items-start gap-3">
      <SheenText
        ref={sheenRef}
        as="p"
        text="Precision crafted surfaces"
        mode="pointer"
        tone="primary"
        className="text-2xl font-semibold tracking-tight"
      />
      <button type="button" onClick={() => sheenRef.current?.sweep()}>
        Run sweep
      </button>
    </div>
  );
}

Accessibility and reduced motion

SheenText renders unsplit text inside a single semantic element (as, default "span"), keeping text selection, copy-paste, and screen-reader output native.

Continuous sweeps pause automatically whenever the element is off-screen (IntersectionObserver), the browser tab is hidden (visibilitychange), or paused={true} is passed. Cycle duration scales with speed and the global Kinetic tempo. Under reduced motion, SheenText clears all gradient and background-clip inline styles, stops the animation loop, and renders solid text-foreground.

API Reference

SheenText

Token-based background-clip light sweep that pauses off-screen and adapts to light, dark, and accent themes.

PropTypeDefaultDescription
textstring-Text string to render (alternative to children).
mode"auto" | "tempo" | "pointer""auto"Auto sweeps on tempo and switches to pointer angle tracking on hover.
tone"foreground" | "primary""foreground"Semantic token source for the sheen peak.
angleDegnumber115Resting gradient sweep angle in degrees.
bandWidthnumber28Highlight band width percentage (clamped 10 to 60).
durationMsnumber2400Base sweep cycle duration in milliseconds.
pausedbooleanfalsePauses automatic tempo sweeps.
speednumber1Speed multiplier combined with global tempo.