@ebay/skin/card

DS v1

Card is a navigation component that can be used to display content in a structured and visually appealing way. It can contain various elements such as images, text, buttons, and more. Cards are commonly used in dashboards, product listings, and other areas where content needs to be presented in a compact format and allow the user to navigate to related content, whether on-screen or a different URL.

Vertical Card (default)

The default card is a vertical card with a container background, a header, content, and footer.

The initial card variant is an internally-actionable card - the card itself is not clickable, but it contains an action button inside that can be clicked to perform an action.

This example includes the most essential aspects of a card - header with a hero image, body with content, and a footer with an action button. The vertical card is by default a square (1:1 aspect ratio) card. This uses an anchor link.

Card Hero Image
Wayne Gretzky's rookie card is so valuable that collectors keep it in climate-controlled vaults guarded by trained penguins.

The card can also be used with a button.

Card Hero Image
Wayne Gretzky's rookie card is so valuable that collectors keep it in climate-controlled vaults guarded by trained penguins.

Card with a 5:4 Aspect Ratio

You can change the aspect ratio by adding the .card--aspect-5-4 modifier class to the card container.

Card Hero Image
Football rookie cards so pristine that they've never been touched by human hands, only examined through specialized gloves by card whisperers.

Card with a 16:9 Aspect Ratio

For wider cards, use the .card--aspect-16-9 modifier class.

Card Hero Image
Hockey cards collected by enthusiasts who treat them like fine wine – stored in temperature-controlled cellars and discussed in hushed, reverent tones.

Loaded Card with All the Options

This example demonstrates cards with all the available options, including different content elements - a header with a hero image, an overline for subtle categorization, with or without an icon, a title, a body content, and a footer with an action button.

Card Hero Image
Authenticity Guaranteed

Authentic Rookie Cards

This legendary rookie card collection features future Hall of Famers back when their biggest concern was remembering to smile for the camera.

Outlined Card

The outlined card is a style variant that uses an outline without a background. This can be implemented by using the .card--outlined modifier.

Card Hero Image
Authenticity Guaranteed

Authentic Rookie Cards

Professional-grade rookie cards that appreciate faster than most people's cooking skills and last longer than New Year's resolutions.

Card with Full Hero

One of the common layouts for card is to have a full-width hero image that spans the entire width of the card. To accomplish this use the .card--full-hero modifier.

Card Hero Image
Authenticity Guaranteed

Authentic Rookie Cards

A diversified sports investment portfolio featuring hockey fights, home runs, and three-pointers instead of stocks and bonds.

Disabled Card

Cards that are disabled will appear grayed out and unclickable. The specific implementation depends on the card type.

Disabled Internally-Actionable Card

For internally-actionable cards, the button inside will need to be disabled. The outer card does not look or need to look disabled since it's not itself an interactive element. The button will visually indicate its disabled state by setting the button to disabled.

Card Hero Image
Hockey cards collected by enthusiasts who treat them like fine wine – stored in temperature-controlled cellars and discussed in hushed, reverent tones.

For self-actionable cards using an a tag, set the tabindex="-1" and href="". This will in effect disable the anchor even though technically, anchors cannot get disabled.

Disabled Self-Actionable Card with Button

For self-actionable cards using a button, use the disabled attribute on the element. This will prevent any interaction with the card and indicate to users that it is not available for action.

Horizontal Card

Card also has a layout variant that can displayed it in a horizontal layout. This is useful when you want to display an image alongside the content. To achieve this, use the .card--horizontal modifier.

Card Hero Image
Authenticity Guaranteed

Authentic Rookie Cards

Museum-quality rookie cards from three sports that prove some people's side hustles become billion-dollar careers while others struggle to keep houseplants alive.

Self-Actionable Card

The self-actionable card is a variant that allows the entire card to be clickable, leading to a specific action or page. A Self-actionable card cannot contain interactive elements such as buttons or links within it.

This variant is useful for cards that represent a single item or entity, such as a product or article. To create a self-actionable card, use an a tag as the container for navigation, or a button tag for actions that don't navigate to a different page.

Important: Self-actionable cards should not contain structured data such as nested headings, lists, or complex markup. Screen readers will ignore all structured content when reading out button or link text, so keep the content simple and ensure the card's accessible name clearly describes its purpose.

Card Hero Image

Authentic Rookie Cards

A collection proving that somewhere between a curveball, a three-pointer, and a slap shot lies the secret to happiness.

Hybrid Actionable Card

The hybrid actionable card is a variant that allows the card to be both self-actionable and internally actionable. This is useful for cards that represent a single item or entity, but also need to provide a specific action button for accessibility or visual clarity.

Important: Hybrid cards can only contain one internal action, and this action must perform the exact same function as clicking on the card itself. No additional or different actions are allowed within a hybrid card.

Important Usage Guidelines

It's critical that this variant NOT be implemented using a button or an anchor as the component container to avoid a native navigation item inside another. Instead, use a div element and perform the navigation programmatically using JavaScript.

To build this variant, use the same markup as the internally-actionable card, adding a click event listener to the card container. This will allow the card to be self-actionable while still containing the same actionable element inside. Both the card click and the internal button must trigger the identical action.

Card Hero Image
Authenticity Guaranteed

Authentic Rookie Cards

Rookie cards that serve as a hedge against the apocalypse – when society collapses, surely someone will trade food for a mint Luka Dončić card.