ShinyText

Render inline text with a looping white highlight that sweeps across the glyphs.

ShinyText is a client component that renders Text as a Motion div with a text-clipped gradient whose background position animates on a loop. Use it to draw attention to short labels such as announcements or loading states. It depends on motion/react.

New in version 2

Shared workspaces

Import#

typescript
import { ShinyText } from "@reactberry/system/blocks";

Usage#

typescript
import { ShinyText } from "@reactberry/system/blocks";
import { Box } from "@reactberry/system/elements";

export default function Eyebrow() {
  return (
    <Box p="m">
      <ShinyText fontSize="small" fontWeight={600} textTransform="uppercase">
        New in version 2
      </ShinyText>
    </Box>
  );
}

Examples#

Sweep speed#

speed is the duration of one sweep in seconds, so lower values are faster.

Limited offer (default, 10s)
Limited offer (4s)

Respecting reduced motion#

The component has no reduced-motion handling. Pass useReducedMotion() from @reactberry/system to disabled to stop the animation for people who prefer less motion.

Generating summary…

API#

ShinyText#

PropTypeDefaultDescription
children*
ReactNode
—

Text content, wrapped in a span.

disabled
boolean
false

Stops the animation.

speed
number
10

Duration of one sweep in seconds; higher values are slower.

color
string
tertiary

Text colour.

fontSize
string
medium

Font size token.

fontWeight
string | number
normal

Font weight.

textTransform
string
—

Passed through to Text.

All remaining props are spread onto the Text element (typed as [key: string]: any). The element renders with display="inline-block".

Notes#

  • The animation moves backgroundPosition from 200% 0 to -200% 0 with linear easing, repeats indefinitely and starts after a 3 second delay.
  • The highlight is a 120 degree white gradient clipped to the text with background-clip: text. It is painted behind the text fill, so it is only visible where the text colour is not fully opaque.
  • Passing style replaces the gradient and clipping styles.