---
title: Lanyard Badge
description: An ID badge on two straps that you can grab, swing and flick.
category: Cards
tier: pro
url: https://ui.dimaac.com/components/lanyard-badge
registry: https://api.dimaac.com/v1/ui/r/lanyard-badge.json
registry_auth: Authorization: Bearer <DiMaac licence key>
---

# Lanyard Badge

A badge card hanging from a lanyard, with real physics. Matter.js runs the card, a clip and two straps of twelve springy links each; the card is plain HTML, so it holds anything, and it hangs from a chrome lobster clasp that threads through a slot cut in the card. It drops in on load, tilts and catches a sliding sheen as it moves, brushes aside when the mouse passes over it, and can be dragged and flicked with a mouse or a finger (only the card takes the touch, so the page still scrolls around it). Four outlines: a tall badge, a wide one, a disc and a ticket with a tear-off stub. The arrow keys push it, Enter drops it in again. The straps' spring, damping, air drag and grip can be tuned live. With reduced motion it skips the drop, the tilt and the hover push, and the air is thick enough that a drag never becomes a big swing. The world is torn down completely on unmount.

## Install

This is a Pro component: its source is for buyers of Pro Components, a Templates plan or All-Access, and is not on this page. It installs from the authenticated registry, with the licence key in an environment variable.

1. Merge the registry into components.json (the key is never written into the file):

```json
{
  "registries": {
    "@dimaac-pro": {
      "url": "https://api.dimaac.com/v1/ui/r/{name}.json",
      "headers": { "Authorization": "Bearer ${DIMAAC_LICENSE_KEY}" }
    }
  }
}
```

2. Put the licence key in `.env.local` (keep it out of git; never print or commit it). Ask the owner for it if it isn't set:

```bash
DIMAAC_LICENSE_KEY=your-licence-key
```

3. Add the component:

```bash
npx shadcn@latest add @dimaac-pro/lanyard-badge
```

The registry item is https://api.dimaac.com/v1/ui/r/lanyard-badge.json and answers only with `Authorization: Bearer <licence key>` (or `X-License-Key`). It answers 401 without a key, 403 for a key that isn't valid, and 402 for a key whose purchase doesn't include Pro components (see https://ui.dimaac.com/pricing).

Dependencies:

```bash
pnpm add gsap @gsap/react matter-js
npm install gsap @gsap/react matter-js
```

By hand:

Unlock the code on https://ui.dimaac.com/components/lanyard-badge with your licence key, then:

1. Install the packages it uses: gsap, @gsap/react, matter-js.
2. Copy the component file from the Code panel (once your licence key unlocks it) into components/dimaac/lanyard-badge.tsx.
3. It's styled with Tailwind v4 classes. If that folder sits outside the places Tailwind scans, add it with @source in your CSS.
4. Import it with import { LanyardBadge } from "@/components/dimaac/lanyard-badge" and give its parent a size: it fills it.

## Usage

```tsx
import { LanyardBadge } from "@/components/dimaac/lanyard-badge";

<LanyardBadge />
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | - | What's printed on the card. It fills the card, so give it its own background. |
| `shape` | `LanyardShape` | `"portrait"` | The card's outline: a tall badge, a wide one, a disc or a ticket with a tear-off stub. |
| `strapColor` | `string` | `"#0f766e"` | The strap's colour (also the fabric tab at the clasp). |
| `strapTextColor` | `string` | `"#99f6e4"` | The colour of the words woven into the strap and of the tab's stitches. |
| `strapText` | `string` | `"DiMaac UI"` | The words repeated along the strap. Empty for a plain strap. |
| `stiffness` | `number` | `0.3` | How springy the straps are: low is stretchy, 1 is a stiff chain. |
| `damping` | `number` | `0.1` | How quickly the straps stop bouncing. |
| `airFriction` | `number` | `0.03` | Air drag on the card: low keeps it swinging, high settles it fast. |
| `dragStiffness` | `number` | `0.05` | How hard the card follows the pointer while it's held. |
| `dropOnLoad` | `boolean` | `true` | The card falls in from above when it first appears. |
| `dropHeight` | `number` | `650` | How far above its resting place the card starts its fall, in pixels at full scale. |
| `label` | `string` | `"Badge on a lanyard. Drag it, or use the arrow keys to swing it."` | What screen readers call the card. |
| `cardClassName` | `string` | `"bg-white text-neutral-900"` | Extra classes for the card's face (the box the children fill). |
| `className` | `string` | `""` | Extra classes for the outer box. Give it a size (it fills it): the scene scales to its height. |

## Credits

- Portrait: Benginur Hajjaj, Lummi (https://www.lummi.ai/photo/calm-portrait-d1zqo), Lummi License

## Source

The source of a Pro component is for buyers of Pro Components, a Templates plan or All-Access. Install it with the commands above, or unlock it on https://ui.dimaac.com/components/lanyard-badge.

## Agent prompt

```text
Add the Lanyard Badge component (<LanyardBadge />) from DiMaac UI to this project. It is a Pro component, so its source needs the owner's DiMaac licence key (Pro Components, a Templates plan or All-Access).

Docs: https://ui.dimaac.com/components/lanyard-badge

1. Add the Pro registry to components.json (merge it into "registries"). Don't write the key into the file:
{
  "registries": {
    "@dimaac-pro": {
      "url": "https://api.dimaac.com/v1/ui/r/{name}.json",
      "headers": { "Authorization": "Bearer ${DIMAAC_LICENSE_KEY}" }
    }
  }
}

2. The owner puts their licence key in .env.local (keep it out of git): DIMAAC_LICENSE_KEY=your-licence-key
   Ask them for it if it isn't set. Never print it or commit it.

3. Install it with:
npx shadcn@latest add @dimaac-pro/lanyard-badge

The registry item is https://api.dimaac.com/v1/ui/r/lanyard-badge.json and wants the header "Authorization: Bearer <licence key>".

Then use it like this:
import { LanyardBadge } from "@/components/dimaac/lanyard-badge";
<LanyardBadge />

It imports gsap, @gsap/react, matter-js; the CLI installs them. It uses Tailwind v4 classes, so make sure Tailwind scans that folder.
Give its parent a size, keep light and dark mode working and keep its prefers-reduced-motion fallback.
Full index for agents: https://ui.dimaac.com/llms.txt
```
