Skip to content

Card Shuffle Deck

A reorderable neo-brutalist deck where cards lift onto their shadows, travel in straight lines and land exactly. Drag, shuffle or move with the keyboard; ranks stamp as cards land.

ProBrutalismbrutalistplayful

This is a viberdy Pro component

The live preview, the props panel and the write-up are open to everyone. The full source, the AI prompt and CLI install are part of Pro.

Preview

Merge queue

Drag to reorder · Space to pick up

  • 01

    Preview comments on pull requests

    #482featureNadia

  • 02

    Cold starts under a second

    #479perfTheo

  • 03

    Stale preview links after a force-push

    #485fixPriya

  • 04

    Team seats and roles

    #471billingSam

  • 05

    Dark mode for the dashboard

    #488uiInes

  • 06

    Docs: monorepo setup

    #490docsOla

Props

Shuffle and Reset
No runtime dependencies
"use client";

import { useEffect, useId, useRef, useState } from "react";
import type { CSSProperties, KeyboardEvent as ReactKeyboardEvent, PointerEvent as ReactPointerEvent } from "react";

/**
 * CardShuffleDeck — a neo-brutalist reorderable deck where every card moves
 * like a physical object: it lifts onto its shadow, travels in a straight
 * line, and lands exactly in its slot.
 *
 * The rule the whole piece is built on: a shadow never interpolates. Each
 * card's shadow is a fixed ink plate 5px under it, and only the card moves
 * over it: up 2px on hover, up 4px when it is in the air, back to 0 when it
 * lands, 100ms linear. So the shadow never stretches, blurs or fades; it is
 * simply uncovered. Travel between slots is linear too, never eased.
 *
 * - Drag a card (mouse or pen anywhere on it, touch on its grip): it lifts
 *   and follows the pointer; the others slide aside in 140ms linear; let go

  // ---------------------------------------------------------------
  // Full source available with a viberdy Pro subscription.
  // https://viberdy.dev/pricing
  // ---------------------------------------------------------------
}
Notes

About this animation

Most drag-to-reorder lists slide their items around on an ease and let the shadow swell and shrink with them. A hard shadow can't do that and stay believable, so this deck follows one rule: a shadow never interpolates. A card is either on the ground, on a 5px hard shadow, or in the air, lifted 4px on a 9px one, and it switches between the two in a single frame. Only travel is animated, and always linearly. Drag a card and it lifts and follows your pointer while the others slide aside; let go and it travels to its slot and lands. Press Shuffle and every card lifts at once, flies to a new slot, and they land one after another, each stamping its new rank as it touches down. Reset lands them back in order. The card in first place fills with the accent. From the keyboard, Space picks up a card, the arrow keys move it, Space drops it and Escape puts it back, with every step read out. It reports the new order through onReorder, so it works as a real priority list, merge queue or ranking.

Curator’s note

Part of the Brutalism kit, drop 3, phase 10: the kit's motion primitive. Pro because it is a stateful reorder system: pointer drag with slot hit-testing, a choreographed shuffle, keyboard pick-up and move, and a narrated live region.

Related

Pairs well with

Matched on shared tags and category — the entries most likely to be used alongside this one.

Featured
NewPro

A neo-brutalist first screen: a slab headline beside a pile of hard-shadow cards you can grab and throw. Thrown cards fly off and cut to the bottom; the rest step up. Nothing eases.

heroneo-brutalismbrutalist
NewPro

A neo-brutalist bar whose menu is a full-screen index that cuts in and out in one frame: huge section rows between 3px rules, a hard inverted selection, links and a feature card beside it.

navigationmega menumenu

A "customise your dashboard" panel: drag or keyboard reorder, show and hide switches, a live miniature of the result, and save, cancel and reset.

reorderdrag and dropdashboard