Skip to content

Comic Text

Bold, outlined, comic-style text with a hard offset shadow and an optional pop-in when it first appears.

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.

Boom
import { ComicText } from "@rdloom/react";

export default function ComicTextBasicExample() {
  return (
    <div className="flex w-full justify-center py-6">
      <ComicText className="text-6xl">Boom</ComicText>
    </div>
  );
}

Installation

npx rdloom add comic-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/comic-text.json

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

Usage

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

<div className="flex w-full justify-center py-6">
  <ComicText className="text-6xl">Boom</ComicText>
</div>

Pop in

Pop
import { ComicText } from "@rdloom/react";

export default function ComicTextPopInExample() {
  return (
    <div className="flex w-full justify-center py-6">
      <ComicText popIn className="text-6xl">
        Pop
      </ComicText>
    </div>
  );
}

Custom colors

Wow
import { ComicText } from "@rdloom/react";

export default function ComicTextCustomColorsExample() {
  return (
    <div className="flex w-full justify-center py-6">
      <ComicText fill="#fde047" outline="#1e1b4b" className="text-6xl">
        Wow
      </ComicText>
    </div>
  );
}

API Reference

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

PropTypeDefault
childrenrequired

The text.

stringnone
popIn

Plays one short pop when the text first appears.

booleanfalse
fill

Letter colour, any CSS colour.

string"var(--rd-color-surface-default)"
outline

Outline and shadow colour, any CSS colour.

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

Skips the pop-in and shows the text plainly.

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 playful title, label or sticker

Avoid it when

  • Serious or dense content

Don't

  • Fill and outline colours with little contrast between them

Design tokens

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

  • --rd-color-text-default
  • --rd-color-surface-default