Card
Also called card component or content card
A bordered, rounded container that groups one item’s image, title, details, and actions so it can sit in a list or grid with others.
type Stay = {
id: string;
name: string;
photo: string;
location: string;
rating: number;
price: number;
};
export function StayCard({ stay }: { stay: Stay }) {
return (
<article className='relative flex h-full flex-col overflow-hidden rounded-xl border bg-background shadow-sm transition-shadow hover:shadow-md'>
<img
src={stay.photo}
alt=''
className='aspect-16/10 w-full object-cover'
/>
<div className='flex flex-1 flex-col gap-1 p-4'>
<h3 className='font-semibold'>
{/* The ::after layer stretches this link over the whole card. */}
<a
href={`/stays/${stay.id}`}
className='after:absolute after:inset-0'
>
{stay.name}
</a>
</h3>
<p className='text-sm text-muted-foreground'>
{stay.location} · ★ {stay.rating}
</p>
{/* mt-auto pins the actions to the bottom when titles wrap. */}
<div className='mt-auto flex items-center justify-between pt-3'>
<span className='font-medium'>
${stay.price}
<span className='font-normal text-muted-foreground'> night</span>
</span>
{/* relative z-10 lifts the button above the stretched link. */}
<button
type='button'
className='relative z-10 rounded-full bg-primary px-4 py-2 text-sm font-medium text-primary-foreground'
>
Book
</button>
</div>
</div>
</article>
);
}Design a listing card: a 16:10 image with 12px rounded top corners, a 16px semibold title, a meta row with location and rating in muted gray, and a bottom row with the nightly price and a "Book" button. Use a 1px border and a soft shadow that grows slightly on hover, make the whole card clickable through the title link, and keep cards in a row the same height.
Paste into Layerwise or any AI coding tool.
What is Card?
A card is a self-contained preview of one thing: a product, a listing, an article, a project. The usual anatomy, top to bottom, is media (an image or thumbnail), a title, meta information (price, date, author, rating), and actions (a button, a link, a favorite icon). The border, background, and shadow make the group read as one object.
Naming the parts makes prompts precise: "Make the card media 16:9 with rounded top corners", "Move the price into the card meta", or "Show the card actions only on hover". Cards in a row should share the same height, so pin the actions to the bottom when titles wrap to different lengths.
If the whole card should be clickable, make the title a real link and stretch its click area over the card with an ::after pseudo-element set to position: absolute; inset: 0. Give any other buttons on the card position: relative and a z-index so they stay clickable on top of that area, and screen readers still hear one clear link.
Related terms
All termsBento grid
A grid of rounded tiles in mixed sizes that fit together like a bento lunch box, often used to show several features at once.
Drop shadow
A shadow cast behind an element to make it look raised off the page, with larger, softer shadows signaling higher elevation.
Hover effect
A visual change, such as a lift, glow, or zoom, that happens when the mouse pointer moves over an element to show it can be clicked.
Border radius
The CSS property that rounds an element’s corners, from a slight softening to a full pill or circle.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.
