Item Card
Ready-made collectible cards for games: an original frame with a rarity edge, an element tint, big art, abilities, flavour text and a set footer. Cards tilt toward the pointer with a foil shine, flip to a custom back, and scale every part from one width. CardHand fans them like a hand; CardGrid lays out a binder.
Pass a CardData object and you are done. Rare cards get a shimmer, epic and legendary get holo foil. Move the pointer over a card to tilt it.
Installation
Usage
Examples
Sizes, flip and not collected
size is "sm", "md", "lg" or a number of px; text and frame scale with it. flipOnClick turns the card over; owned={false} shows a silhouette.
Hand
CardHand fans the cards and shrinks them to fit narrow screens. Click a card to lift it; the selected one stays up.
Pick a card to play.
Binder
CardGrid with ownedIds shows the set you have and silhouettes for the rest.
API
Everything else is passed through to the underlying element or Radix primitive.
| Prop | Type | Default | Description |
|---|---|---|---|
card | CardData<T> | – | { id, name, label?, art?, rarity?, element?, stat?, type?, abilities?, flavor?, footer?, foil?, badge?, data? }. `art` is a React node or an image URL. |
size | "sm" | "md" | "lg" | number | "md" | 160, 240 or 320 px wide, or any width. Height follows the 5:7 card shape and everything inside scales with it. Never wider than its container. |
onSelect / selected / disabled | (card) => void / boolean | – | With onSelect the card is a button (click, Enter, Space). |
flipped / defaultFlipped / onFlippedChange / flipOnClick | boolean / fn | false | Show the back. flipOnClick turns the card on click instead of selecting it. |
back | ReactNode | pattern | Your own card back (logo, set art). |
tilt | boolean | true | 3D tilt and glare toward the pointer. Off under reduced motion. |
owned | boolean | true | false shows a dark silhouette with ??? for cards not collected yet. |
card.foil | "holo" | "shimmer" | "none" | by rarity | Holo for epic and legendary, shimmer for rare, none otherwise. |
elements / rarities | Record<string, { label, color, icon? }> | DEFAULT_ELEMENTS / DEFAULT_RARITIES | Your own element and rarity sets; colours are any CSS colour. |
renderArt / renderAbility / renderFooter | fn | – | Replace parts of the front, e.g. a 3D canvas or animated sprite as the art. |
CardHand | { cards, size?, selectedId?, onSelect?, spread?, overlap?, disabledIds?, cardProps? } | spread 24, overlap 0.45 | A fanned hand. `spread` is the total angle in degrees, `overlap` the share each card hides of the previous one. |
CardGrid | { cards, size?, selectedId?, onSelect?, ownedIds?, cardProps? } | – | A responsive binder grid; cards not in ownedIds show as silhouettes. |