Skip to content

Line Shadow Text

Text with a diagonal line-pattern shadow behind it that slowly slides. The shadow copy is hidden from assistive technology.

Motionv0.1.0experimentalWCAG 2.2 AAView spec

Optional, and kept apart.

Nothing here is included in a project unless you add it, and the plain component it builds on is unchanged. This effect is decoration: it is hidden from screen readers, stands still for visitors who prefer reduced motion, and can be paused. Use Still on a preview to see that version.

Depth
import { LineShadowText } from "@rdloom/react";

export default function LineShadowTextBasicExample() {
  return (
    <div className="flex w-full justify-center py-6">
      <LineShadowText className="text-6xl font-black">Depth</LineShadowText>
    </div>
  );
}

Installation

npx rdloom add line-shadow-text

Copies the source into src/components/rdloom. Edit it freely: rdloom upgrade merges later versions into your changes.

It also adds rdloom-motion.css next to your tokens and imports it from the tokens file, once: no setup, and no inline styles. The plain components you already use are untouched.

Use another registry client
npx shadcn@latest add https://rdloom.vimalbhatt.com/r/line-shadow-text.json

Works, but without upgrade tracking, and you import the motion CSS yourself.

Usage

import { LineShadowText } from "@rdloom/react";

<div className="flex w-full justify-center py-6">
  <LineShadowText className="text-6xl font-black">Depth</LineShadowText>
</div>

Custom color

Bold lines
import { LineShadowText } from "@rdloom/react";

export default function LineShadowTextCustomColorExample() {
  return (
    <div className="flex w-full justify-center py-6">
      <LineShadowText shadowColor="#dc2626" className="text-6xl font-black">
        Bold lines
      </LineShadowText>
    </div>
  );
}

API Reference

Defined by the spec. Components also accept the props of the React Aria component they wrap.

PropTypeDefault
childrenrequired

The text.

stringnone
shadowColor

Colour of the shadow lines, any CSS colour.

string"var(--rd-color-text-muted)"
isPaused

Stops the animation and shows the text plainly. Moving content that lasts more than five seconds should be stoppable.

booleanfalse

Accessibility

Role text, WCAG 2.2 AA. Tested with axe and keyboard tests; screen reader checks are in the audit checklist.

Keyboard

Not interactive.

Screen readers announce

  • Read as ordinary text: the effect is purely visual

What your code must do

  • The text is ordinary text in the page from the server render, readable with no JavaScript, and read once by screen readers
  • Decoration only: the animated layers are hidden from assistive technology and never take focus
  • Stands still for visitors who ask for less motion (prefers-reduced-motion), and can also be shown still with the rdm-still class or isPaused
  • In forced-colors (high contrast) mode the text is drawn in the system colours with no effect
  • Does not flash: nothing changes more than three times in a second (WCAG 2.3.1)
  • Optional: it is a separate component, so projects that do not add it carry none of its code

Guidelines

Use it when

  • A bold heading that needs depth

Avoid it when

  • Small or light-weight text

Don't

  • Shadow colours so strong they compete with the text

Design tokens

The semantic tokens this component uses. Change them once and every component follows; see Design tokens.

  • --rd-color-text-default