Early accessFull site coming soon. Pro is $49.99 a year. See pricing ›

Nexus UI

Pull Cord, animated React component

A light switch on a cord: a small verlet rope you grab by its bead, pull past its slack and let go to toggle the light. The panel lights up or goes dark and the cord swings and settles; Enter or Space tugs it from the keyboard.

  • Pro
  • Inputs & Controls

Play with it

Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.

Lights off.
Pull the cord.

Props

PropTypeDefaultWhat it does
defaultOnfalseWhether the light starts on.
onChange—Called with the new state when the user pulls the cord or presses Enter/Space on it.
onText"Lights on."Headline while the light is on.
offText"Lights off."Headline while the light is off.
hint"Pull the cord."Small line under the headline.
className—Extra classes for the 320px-wide outer wrapper.
autoplayfalseTugs the cord every 2.6s until someone grabs it.