Cards group related content and actions inside a bordered container. Use them to present products, articles,
user profiles, or any self-contained unit of information.
Mittens
This kitten is as cute as he is playful. Bring him home today!
6 weeks old
More Info
<cs-cardclass="card-overview"><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/><strong>Mittens</strong><br/>
This kitten is as cute as he is playful. Bring him home today!<br/><smallclass="cs-caption-s">6 weeks old</small><cs-buttonslot="footer"variant="brand"pill>More Info</cs-button><cs-ratingslot="footer-actions"label="Rating"></cs-rating></cs-card><style>.card-overview{width: 300px;}</style>
Mittens
This kitten is as cute as he is playful. Bring him home today!
More Info
<cs-card><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten between a terracotta pot and decorative grasses."/><strongslot="header">Mittens</strong>
This kitten is as cute as he is playful. Bring him home today!
<cs-buttonslot="footer"variant="brand"pill>More Info</cs-button><cs-buttonslot="actions"variant="neutral"appearance="plain"><cs-iconname="more_horiz"label="Actions"></cs-icon></cs-button></cs-card>
Examples
Basic Card
A card can hold any content. Media, a header, and a footer are all optional.
This is just a basic card. No media, no header, and no footer. Just your content.
<cs-cardclass="card-basic">
This is just a basic card. No media, no header, and no footer. Just your content.
</cs-card><style>.card-basic{max-width: 300px;}</style>
Header
Headers can be used to display titles and more.
If using SSR, you need to also use the has-header attribute to add a header to the card (if not, it is added automatically).
Header Title
This card has a header. You can put all sorts of things in it!
<cs-cardclass="card-header"><h3slot="header">Header Title</h3>
This card has a header. You can put all sorts of things in it!
<cs-buttonappearance="plain"slot="header-actions"><cs-iconname="settings"label="Settings"></cs-icon></cs-button></cs-card><style>.card-header{max-width: 300px;}.card-header h3{margin: 0;}</style>
Footer
Footers can be used to display actions, summaries, or other relevant content.
If using SSR, you need to also use the has-footer attribute to add a footer to the card (if not, it is added automatically).
This card has a footer. You can put all sorts of things in it!
Preview
<cs-cardclass="card-footer">
This card has a footer. You can put all sorts of things in it!
<cs-ratingslot="footer"></cs-rating><cs-buttonslot="footer-actions"variant="brand">Preview</cs-button></cs-card><style>.card-footer{max-width: 300px;}</style>
Media
Card media is displayed atop the card and will stretch to fit.
If using SSR, you need to also use the has-media attribute to add a media section to the card (if not, it is added automatically).
This card has an image of a kitten walking along a pallet.
This card has a video of a dog wearing shades.
<divclass="cs-grid"><cs-cardclass="card-media"><divslot="media"class="cs-frame:landscape"><imgsrc="https://images.unsplash.com/photo-1547191783-94d5f8f6d8b1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=400&q=80"alt="A kitten walks towards camera on top of pallet."/></div>
This card has an image of a kitten walking along a pallet.
</cs-card><cs-cardclass="card-media"><videoslot="media"controls><sourcesrc="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"/><p>Your browser doesn't support HTML video</p></video>
This card has a video of a dog wearing shades.
</cs-card></div><style>.card-media{max-width: 300px;}</style>
Appearance
Use the appearance attribute to change the card’s visual appearance.
<divclass="cs-grid"><cs-card><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/>
Outlined (default)
</cs-card><cs-cardappearance="filled-outlined"><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/>
Filled-Outlined
</cs-card><cs-cardappearance="plain"><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/>
Plain
</cs-card><cs-cardappearance="filled"><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/>
Filled
</cs-card><cs-cardappearance="accent"><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/>
Accent
</cs-card></div>
Orientation
Set the orientation attribute to horizontal to create a card with a horizontal, side-by-side layout. Make sure to set a width or maximum width for the media slot. Horizontal cards do not currently contain the header and footer slots.
The actions slot is only available for the horizontal orientation.
This card has a horizontal orientation with media, body, and actions arranged side-by-side.
<divclass="cs-grid"><cs-cardorientation="horizontal"class="horizontal-card"><imgslot="media"src="https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"alt="A kitten sits patiently between a terracotta pot and decorative grasses."/>
This card has a horizontal orientation with media, body, and actions arranged side-by-side.
<cs-buttonslot="actions"variant="neutral"appearance="plain"><cs-iconname="more_horiz"label="actions"></cs-icon></cs-button></cs-card></div><style>.horizontal-card{img[slot='media']{max-width: 300px;}}</style>
API
Importing
If you're using the autoloader or a hosted project, components load on demand — no manual import
needed. To cherry-pick this component, use one of the following snippets.
Only required for SSR. Set to true if you're slotting in a footer element so the server-rendered markup includes the footer before the component hydrates on the client.
boolean
false
Yes
hasHeader
has-header
Only required for SSR. Set to true if you're slotting in a header element so the server-rendered markup includes the header before the component hydrates on the client.
boolean
false
Yes
hasMedia
has-media
Only required for SSR. Set to true if you're slotting in a media element so the server-rendered markup includes the media before the component hydrates on the client.
boolean
false
Yes
orientation
orientation
Renders the card's orientation *
'horizontal' | 'vertical'
'vertical'
Yes
ssrFooterActions
ssr-footer-actions
Only required for SSR. Set to true if you're slotting in a footer-actions element so the server-rendered markup includes the media before the component hydrates on the client.
boolean
false
Yes
ssrHeaderActions
ssr-header-actions
Only required for SSR. Set to true if you're slotting in a header-actions element so the server-rendered markup includes the media before the component hydrates on the client.
If you use the header, media, or footer slots, set the matching has-header, has-media, or has-footer attribute — otherwise only the card's body will render during SSR. This works around the lack of a :has-slotted CSS pseudo-class, which would normally let us style borders based on slotted content.