Miss. Train. Move.

Slam dunk

Important notifications. Comes down from above, hits, the rim shakes.

Inbox
    Sport
    Basketball
    Move
    Comes down from above, hits, the rim shakes.
    For
    Important notifications

    falls, hits, wobbles 560ms 路 rim shakes at impact 路 reduced: fade

    01 Install

    Terminal
    npx shadcn@latest add https://moveui-red.vercel.app/r/slam-dunk.json

    It brings the tokens with it. The first time, import the tokens once in your root layout:

    app/layout.tsx
    import "@/components/moveui/tokens.css";

    Not using shadcn? Copy the files below into components/moveui/, and tokens.css next to them.

    02 Use it

    Example
    import "@/components/moveui/slam-dunk/slam-dunk.css";
    
    // The alert falls in. Set data-hit on the rim (a bell, an inbox) about 38% into the fall.
    <span key={hits} className="ml-dunk-rim" data-hit={hits ? "" : undefined}>馃敂</span>
    <ol aria-live="assertive">
      {alerts.map((a) => (
        <li key={a.id} className="ml-dunk" data-open="">{a.text}</li>
      ))}
    </ol>

    03 Or ask your agent

    Paste this into Claude Code, Cursor or any coding agent. It installs the piece and wires it in.

    Prompt
    Add the Move UI "Slam dunk" piece to this project. It's for: Important notifications.
    
    1. Install it: npx shadcn@latest add https://moveui-red.vercel.app/r/slam-dunk.json
    2. If the project doesn't import the Move UI tokens yet, add this once to the root layout: import "@/components/moveui/tokens.css";
    3. Use it like this, adapted to where it belongs in my code:
    
    import "@/components/moveui/slam-dunk/slam-dunk.css";
    
    // The alert falls in. Set data-hit on the rim (a bell, an inbox) about 38% into the fall.
    <span key={hits} className="ml-dunk-rim" data-hit={hits ? "" : undefined}>馃敂</span>
    <ol aria-live="assertive">
      {alerts.map((a) => (
        <li key={a.id} className="ml-dunk" data-open="">{a.text}</li>
      ))}
    </ol>
    
    Keep its reduced-motion behaviour and keyboard support. Don't hardcode durations, easing or colours: they come from the --ml-* tokens.
    Docs: https://moveui-red.vercel.app/pieces/slam-dunk

    Want your agent to know the whole library and its motion rules? Add the Move UI skill to your project:

    Terminal
    npx shadcn@latest add https://moveui-red.vercel.app/r/skill.json

    04 Code

    components/moveui/slam-dunk/slam-dunk.css
    /*
      Slam dunk (basketball): comes down from above, hits, and the rim shakes. For notifications that matter.
      The surface: .ml-dunk falls with gravity, squashes on impact, wobbles once and settles (--ml-dur-travel).
      The rim: put .ml-dunk-rim on what it lands on (a bell, an inbox icon) and set [data-hit] at the moment
      of impact; it shakes and calms down. Re-set the attribute (or re-key the element) to shake it again.
      Out: --ml-dur-exit fade and lift. Reduced motion: a fade, no shake.
    */
    .ml-dunk {
      opacity: 0;
      translate: 0 -6px;
      transition:
        opacity var(--ml-dur-exit) var(--ml-ease-out),
        translate var(--ml-dur-exit) var(--ml-ease-out),
        overlay var(--ml-dur-exit) allow-discrete,
        display var(--ml-dur-exit) allow-discrete;
    }
    .ml-dunk[data-open],
    .ml-dunk:popover-open {
      opacity: 1;
      translate: 0 0;
      transform-origin: 50% 0%;
      animation: ml-dunk-in var(--ml-dur-travel) both;
    }
    @keyframes ml-dunk-in {
      0% { opacity: 0; transform: translateY(-44px) scale(0.96); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
      12% { opacity: 1; }
      /* the hit: impact at about 38% (that is when the rim gets [data-hit]) */
      38% { transform: translateY(0) scale(calc(2 - var(--ml-impact-y)), var(--ml-impact-y)); animation-timing-function: var(--ml-ease-out); }
      54% { transform: translateY(-3px) rotate(-1deg); animation-timing-function: ease-in-out; }
      72% { transform: translateY(0) rotate(0.7deg); animation-timing-function: ease-in-out; }
      86% { transform: rotate(-0.3deg); }
      100% { opacity: 1; transform: none; }
    }
    
    .ml-dunk-rim { transform-origin: 50% 10%; }
    .ml-dunk-rim[data-hit] { animation: ml-dunk-rim var(--ml-dur-travel) var(--ml-ease-out); }
    @keyframes ml-dunk-rim {
      0% { rotate: 0deg; }
      14% { rotate: 14deg; }
      30% { rotate: -11deg; }
      46% { rotate: 7deg; }
      62% { rotate: -4deg; }
      80% { rotate: 1.5deg; }
      100% { rotate: 0deg; }
    }
    @media (prefers-reduced-motion: reduce) {
      .ml-dunk { translate: none; }
      @keyframes ml-dunk-in { from { opacity: 0; } to { opacity: 1; } }
      .ml-dunk-rim[data-hit] { animation: none; }
    }