Card
fluid-functionalism/cardFreeComponent
shadcn's compositional card (Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent, CardFooter) with the Fluid Functionalism layer: transparent substrate, weight-animated title, media/logo/feature/image slots, and a CardGroup that owns stacked, inline, and grid layouts plus 2-D proximity-hover highlighting.
Install it
npx shadcn@latest add https://fluidfunctionalism.com/r/card.jsonSource
1"use client";23import {4 Children,5 cloneElement,6 createContext,7 forwardRef,8 isValidElement,9 useContext,10 useEffect,11 useMemo,12 useRef,13 type HTMLAttributes,14 type ReactElement,15 type ReactNode,16} from "react";17import Link from "next/link";18import { motion, AnimatePresence } from "framer-motion";19import { cn } from "@/lib/utils";20import { spring } from "@/lib/springs";21import { fontWeights } from "@/lib/font-weight";22import { useShape } from "@/lib/shape-context";23import { useIcon, type IconComponent } from "@/lib/icon-context";24import { useProximityHover } from "@/hooks/use-proximity-hover";2526// ---------------------------------------------------------------------------27// Card is shadcn/ui's compositional card — the same parts and `data-slot`28// contract (Card, CardHeader, CardTitle, CardDescription, CardAction,29// CardContent, CardFooter) — with the Fluid Functionalism layer on top:30// design tokens, a weight-animated title, and a sibling CardGroup that owns31// layout (stacked list, inline rows, or grid) plus the magnetic proximity32// highlight that previews where a click will land.33//34// Unlike stock shadcn, the surface is transparent and borderless by default:35// cards inherit whatever substrate their parent provides (see the Surfaces36// system) and lean on hairline dividers / the proximity highlight rather than37// a drawn frame. A Card renders fine on its own; inside a CardGroup it38// registers itself so the group's highlight can find it.39// ---------------------------------------------------------------------------4041type CardOrientation = "card" | "inline";42type CardBorder = "none" | "outlined";4344// ── Group context ────────────────────────────────────────4546interface CardGroupContextValue {47 registerItem: (index: number, element: HTMLElement | null) => void;48 activeIndex: number | null;49 /** Index of the persistently-selected card, or -1. Its neighbours drop the50 * hairline that would otherwise cut across the selection fill. */51 selectedIndex: number;52 orientation: CardOrientation;53 columns: number;54 count: number;55 /** Individual cards carry their own border/tile shape (separated grids). */56 separated: boolean;57 /** Inner hairline dividers are drawn between adjacent cards. */58 divided: boolean;59 outlined: boolean;60}6162const CardGroupContext = createContext<CardGroupContextValue | null>(null);6364// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from fluid-functionalism
All 53 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | fluid-functionalism | Components | Free | 3 deps | |
| Accordion (Base UI)accordion-base | fluid-functionalism | Components | Free | 3 deps | |
| Ask User Questionsask-user-questions | fluid-functionalism | Components | Free | 2 deps | |
| Badgebadge | fluid-functionalism | Components | Free | 1 dep | |
| Buttonbutton | fluid-functionalism | Components | Free | 4 deps | |
| Button (Base UI)button-base | fluid-functionalism | Components | Free | 4 deps | |
| Chat Messagechat-message | fluid-functionalism | Components | Free | 1 dep | |
| Checkbox Groupcheckbox-group | fluid-functionalism | Components | Free | 2 deps |
