Lanyard Badge, animated React component
- Pro
- Cards
- Spring
- 3D
A conference badge hanging from a strap. Grab it and throw it around; it swings back as a damped pendulum and twists with its sideways speed.
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| name | string | "Alex Rivera" | Attendee name; the avatar shows its initials. |
| role | string | "Design Engineer" | Line under the name. |
| event | string | "Motion Summit" | Event name printed at the top (followed by 2026). |
| tag | string | "Speaker" | Label on the coloured band at the bottom of the badge. |
| strap | string | "#0071e3" | Strap, band and avatar colour. |
| autoplay | boolean | false | Gives the badge a nudge every few seconds until someone grabs it. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Lanyard Badge is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Lanyard Badge works
back as a damped pendulum, twisting with its sideways speed.
The source, the install command and the build prompt come with Pro.
Lanyard Badge questions
How do I install the Lanyard Badge?
Run `npx shadcn@latest add @nexus-labs/lanyard-badge`. It installs framer-motion; there is no physics library, the swing is a small simulation written in the component. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).
How do I change the name, role and colors on the badge?
Use `name` (default "Alex Rivera", also used for the avatar initials), `role`, `event` (default "Motion Summit"), `tag` for the bottom band text (default "Speaker") and `strap` (default `#0071e3`) for the strap, band and avatar color. The year printed after the event name is fixed at 2026 in the source, so edit the file to change it.
How does the swinging physics work?
A requestAnimationFrame loop moves the badge as a damped pendulum on a fixed-length strap that stretches a little while you drag, and writes the result into Framer Motion values. The strap is an SVG path that sags as the badge moves, and the badge twists with `rotateY` based on its sideways speed.
Can I use it with the keyboard?
Yes. The badge is focusable with a visible focus ring, ArrowLeft and ArrowRight flick it sideways, and Enter or Space toss it up. `autoplay` (default false) nudges it every few seconds until someone touches it.

