AnimationUpdated in v15

Shiny Text

Text with a light stripe sweeping across it.

Installation

Import the class, and @use the entry point in your global styles: without it the component renders unstyled.

import { Component } from '@angular/core';
import { WrShimmer, WrShinyText } from 'ngwr/bits/shiny-text';

@Component({ imports: [WrShimmer, WrShinyText] })
export class MyComponent {}
Angular adaptation of an effect by David Haz / reactbits.dev.

Playground

Premium
<wr-shiny-text
  text="Premium"
  [speed]="2"
  [spread]="120"
  direction="left"
  [yoyo]="false"
  [pauseOnHover]="false"
/>

Customize

Speed (s)
2.0 s
Spread (°)
120 °
Direction
Yoyo
Pause on Hover
Text

Directive variant ([wrShimmer])

[wrShimmer] adds the same sweep to any element.

import { WrShimmer } from 'ngwr/bits/shiny-text';

<h1 wrShimmer>Premium</h1>

Premium

API

NameDescriptionTypeDefault
textrequiredText to render.string—
disabledPause the animation.booleanfalse
speedSeconds for one sweep.number2
colorText colour outside the stripe. Unset, it uses --wr-shiny-text-base.string | nullnull
shineColorStripe colour. Unset, it follows the theme.string | nullnull
spreadGradient angle in degrees.number120
yoyoBounce back-and-forth instead of restarting.booleanfalse
pauseOnHoverPause the animation while hovered.booleanfalse
directionSweep direction.'left' | 'right''left'
delayRest between sweeps, in seconds.number0
[wrShimmer]Adds a continuous sweep to any element.directive—

CSS variables

Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/bits/shiny-text's own element.

VariableDefaultDeclared on
--wr-shiny-text-baselight-dark(var(--wr-color-on-surface-muted, #8594a4), #b5b5b5).wr-shiny-text
--wr-shiny-text-motion1.wr-shiny-text
--wr-shiny-text-progress0 only under from — unset elsewherefrom +1 variant override
--wr-shiny-text-shinelight-dark(var(--wr-color-on-surface, #0f172a), #ffffff).wr-shiny-text

See also