Skip to content

Hanging Card

A suspended badge swings naturally after you drag and release its handle.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import HangingCard from "./HangingCard";
export default function Example() {
return (
<HangingCard
eyebrow={"VISITOR / STUDIO 010"}
children={"Good things\ntake shape."}
footer={"DESIGN DEPARTMENT"}
color={"#c5b29d"}
background={"#e4dacb"}
strapColor={"#777b92"}
height={420}
width={240}
label={"Move card"}
disabled={false}
/>
);
}

Using Hanging Card

Drag the handle at the top of the badge to set it in motion. The left and right arrow keys also swing the card, and Home returns it to the centre.

Supply all badge content through children, eyebrow and footer. Reserve enough height for your content and leave room around the card for its swing.

Props

NameTypeRequiredDefaultDescription
childrenReactNodeNoundefinedMain badge content.
eyebrowReactNodeNoundefinedOptional small heading.
footerReactNodeNoundefinedOptional footer content.
colorstringNo"#c5b29d"Footer divider colour.
backgroundstringNo"#e4dacb"Badge surface colour.
strapColorstringNo"#777b92"Woven strap colour.
heightnumber | stringNo420Reserved height around the swinging card.
widthnumberNo240Badge width in pixels, limited to 70% of the available width.
labelstringNo"Move card"Accessible drag-handle label.
disabledbooleanNofalseDisable the drag handle.
classNamestringNo""Additional classes on the root element.
styleCSSPropertiesNoundefinedInline styles for sizing, typography and appearance.

Related components

A paper flap lifts in 3D as a message slides out of its envelope.

A lightly textured receipt pairs precise item rows with a torn paper edge.

Fine metallic grooves catch a shifting iridescent pointer highlight.

A precision-cut card with chamfered corners and a folded accent.