Skip to content

YoujIcon

Animate lucide-react icons with the same triggers as Youj icons.

Use YoujIcon to animate a lucide-react icon with hover, mount or loop triggers. When a Youj icon fits, use it for animation designed around that icon’s meaning.

Installation

npm i @youj/icons

import { YoujIcon } from '@youj/icons'

For an app already set up with npx @youj/cli init, which installs the peers (@youj/core, @youj/motion, motion and Base UI) and wires the provider. New app? Start at Installation.

This integration is optional. Youj icons need no Lucide dependency. To use the Lucide examples below, add it to your app:

npm i lucide-react

Usage

Pass the lucide component itself, not an element, and pick an effect.

import { Rocket } from 'lucide-react'
import { YoujIcon } from '@youj/icons'

export function DeployButton() {
  return (
    <button type="button">
      <YoujIcon icon={Rocket} effect="bounce" size={16} />
      Deploy
    </button>
  )
}

It plays on hover by default and follows the same trigger rules as Youj's icons: hovering or keyboard-focusing the button bounces the rocket. size and strokeWidth pass through to the lucide icon.

Examples

Effects

Seventeen move the whole glyph, and five animate each stroke's pathLength.

EffectWhat it does
popSqueezes, pops past full size and settles. The default.
wiggleA damped rotation, back and forth.
spinOne full turn, always forwards. Two when strong.
nudgeOut and back along direction.
pulseSwells and dims, then returns.
ringSwings from near the top, like a bell.
bounceTwo hops, the second smaller.
flipA coin turned once on its vertical axis, with perspective.
swingA pendulum hung from the top edge, dying away.
floatLifts, then bobs for as long as it's active.
heartbeatA strong beat, a softer one, then a long release.
shakeA hard horizontal shake that decays, for errors.
jellySquash and stretch on the ground line. Use it sparingly.
orbitOne lap around its own center.
tiltCocks to one side and holds while active.
zoom-inDips away and returns from small. On mount, arrives from small.
zoom-outDips away and lands from large, like a stamp. On mount, arrives from large.
drawRe-traces every stroke.
draw-inRests undrawn, draws on while active, and retracts when it ends.
draw-outStrokes run out through their ends while active, and grow back after.
draw-sequenceWrites the icon one stroke at a time, at a constant pen speed.
stagger-drawA wave through the strokes: each rewinds and redraws in turn, so the icon never goes blank.

Four effects hold while active instead of playing once: float, tilt, draw-in and draw-out. The rest are one-shots. Every effect starts from the icon's current pose, so triggering it again mid-flight carries on from where the icon is instead of jumping.

Reference

Propsicon, effect, trigger… (11)

Props

YoujIcon props
PropType
iconRequiredLucideLikeIcon

Any lucide-react icon component (or one shaped like it).

–
effectYoujIconEffect
'pop''wiggle''spin''draw''nudge''pulse''ring''bounce''flip''swing''float''heartbeat''shake''jelly''orbit''tilt''zoom-in''zoom-out''draw-in''draw-out''draw-sequence''stagger-draw'

default 'pop'

'pop'
triggerIconTrigger
'hover''mount''loop''none'

Default hover; draw-in defaults to mount, since it rests undrawn.

–
activeboolean

Controlled: plays the effect whenever this turns true (held effects hold while it stays true).

–
intensityYoujIconIntensity
'subtle''default''strong'

default 'default'

'default'
directionYoujIconDirection
'up''down''left''right'

default 'right'

'right'
sizenumber | string

default 24

24
strokeWidthnumber

default 1.5

1.5
classNamestring–
styleCSSProperties–
aria-labelstring

Gives the icon role="img". Without it the icon is decorative (aria-hidden).

–
MotionOne-shots, longer one-shots, nudge… · reduced motion

Motion

Motion tokens
MomentTokens
One-shotspop, wiggle, pulse, ring, bounce, shake, jelly, zoom-in, zoom-out
duration.deliberate

560ms

560ms
Longer one-shotsheartbeat ×1.25, orbit ×1.4, swing ×1.5
duration.deliberate

560ms

560ms
Nudgeout and back
duration.slowease.emphasized

340ms · cubic-bezier(0.6, 0, 0.1, 1)

340mscubic-bezier(0.6, 0, 0.1, 1)
Spinone turn
duration.deliberateease.enter

560ms · cubic-bezier(0.16, 1, 0.3, 1)

560mscubic-bezier(0.16, 1, 0.3, 1)
Flipone turn in 3D
duration.deliberateease.emphasized

560ms · cubic-bezier(0.6, 0, 0.1, 1)

560mscubic-bezier(0.6, 0, 0.1, 1)
Tiltcocks and holds
spring.snappy

0.2s, bounce 0

0.2s, bounce 0
Floatlifts, then bobs on a 3 × deliberate cycle
duration.slowease.enter

340ms · cubic-bezier(0.16, 1, 0.3, 1)

340mscubic-bezier(0.16, 1, 0.3, 1)
Drawsthe default pace
duration.slowease.emphasized

340ms · cubic-bezier(0.6, 0, 0.1, 1)

340mscubic-bezier(0.6, 0, 0.1, 1)
Stroke offsetbetween strokes at the default intensity
stagger.base

40ms step

40ms step
Releaseback to rest when the trigger ends
duration.fastease.standard

140ms · cubic-bezier(0.2, 0, 0, 1)

140mscubic-bezier(0.2, 0, 0, 1)

Reduced motion

The icon stays still and fully drawn. A controlled draw-in that's off, or draw-out that's on, stays hidden while that state holds.

Reduced motion

The icon stays still and fully drawn, so it reads exactly like the plain lucide icon. A controlled draw-in that's off, or draw-out that's on, stays hidden, because hidden is the state it describes.

AccessibilityKeyboard, ARIA, focus

Accessibility

  • The icon is decorative by default (aria-hidden) and never focusable. Inside a labeled button, leave it that way.
  • aria-label makes it role="img" with that name, for an icon that stands alone and means something, like an error mark.
  • Hover effects also play on keyboard focus of the trigger, so keyboard users see the same feedback.
  • An effect doesn't announce anything. If shake reports an error, the error text still has to be in the page, tied to its field.