AnimationUpdated in v15

Star Border

Light rays that run along the edges of a box.

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 { WrStarBorder } from 'ngwr/bits/star-border';

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

Playground

Star border
<wr-star-border mode="infinite" rays="mirror" [speed]="6">
  Star border
</wr-star-border>

Customize

Mode
Rays
Speed (s)
6.0 s

As a button

Use it as an attribute on a button or a link.

<button wr-star-border mode="hover" rays="single" type="button">
  Hover me
</button>

API

NameDescriptionTypeDefault
colorRay colour. Unset, it follows the theme.string | nullnull
speedSeconds per ray sweep.number6
thicknessVertical ray bleed past the panel (px).number1
modeAlways animating, or only on hover.'infinite' | 'hover''infinite'
raysRays along both edges, or just the bottom.'mirror' | 'single''mirror'

CSS variables

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

VariableDefaultDeclared on
--wr-star-border-colorlight-dark(var(--wr-color-primary), #ffffff).wr-star-border
--wr-star-border-opacity1.wr-star-border
--wr-star-border-radius20px.wr-star-border
--wr-star-border-speed6s.wr-star-border

See also