Card

A surface: border, radius, padding and shadow. The content is up to you.

Usage

There are no slots: lay out the content however it needs.

tsx
<Card>
  <h3>Invoice 0142</h3>
  <p>Issued on 4 August</p>
</Card>

Invoice 0142

Issued on 4 August

Clickable

When the whole card is clickable, render it as a link or a button with as. It gets a focus ring for free.

tsx
<Card as={Link} to="/margo-ui/button" className="block">
  <h3>Button</h3>
  <p>A card that is a link</p>
</Card>

Edge to edge

tsx
<Card className="overflow-hidden p-0">
  <img src={cover} alt="" />
  <div className="p-5">…</div>
</Card>

Cover

With a glow

tsx
<BorderGlow>
  <Card className="col-span-4">…</Card>
</BorderGlow>

Hover me

Reference

proptypedefault
as?ElementType"div"the element or component to render
className?string—added after the component's own class: what you set wins
…restprops of as—typed against the chosen element