Skip to content

Card ​

A versatile and feature-rich card container component with purposeful variants, color themes, elevation control, and interactive states. Perfect for grouping related content, creating structured layouts, and building modern UI patterns. Built with accessibility in mind and fully customizable through CSS custom properties.

Variants ​

Four surface treatments cover the range from solid to translucent:

  • Default (no variant) - Canvas background with gentle border. Picks up color as a tinted backdrop.
  • solid - Filled with the theme color; best for prominent cards with a color attribute.
  • flat - Subtle backdrop tint with a semi-transparent border; low visual weight.
  • frost - Frosted glass with stronger blur and color-tinted transparency.

Elevation Control

Use the elevation prop (0-5) to control shadow depth. Works with any variant.

html
<!-- No shadow -->
<ore-card elevation="0">Flat appearance</ore-card>

<!-- High elevation -->
<ore-card elevation="4">High shadow</ore-card>
Full width

Frost Variant ​

Modern frost effect with backdrop blur that adapts based on color:

  • Without color: Subtle canvas-based frost overlay
  • With color: Frosted glass effect with colored tint

Best Used With

Frost variant works best when placed over colorful backgrounds or images to showcase the blur and transparency effects.

Full width

Padding Sizes ​

Control the internal spacing of the card.

Full width

Color Themes ​

Apply semantic color themes to cards for different contexts.

Full width

Elevation Levels ​

Control shadow depth with explicit elevation levels (0-5).

Full width

Orientation ​

Set orientation="horizontal" for a side-by-side media + content layout. The vertical layout is the default and requires no attribute. Narrow cards collapse back to the stacked layout automatically: the switch tracks the card's own width, not the viewport, so a horizontal card in a phone-width list or a sidebar never squeezes its body beside a fixed-width media column.

Full width

Media & Actions Slots ​

Media Slot ​

Add images, videos, or custom content at the top of the card (or left side in horizontal orientation). Always provide meaningful alt text for images placed in the media slot.

Full width

Actions Slot ​

Separate slot for action buttons with automatic layout. If the card needs inner actions, place buttons or links in the actions slot: nested interactive elements do not trigger card activation. A card that hosts actions is not interactive: see Interactive Cards for why the two shapes are mutually exclusive.

Full width

States ​

Disabled State ​

Dim an interactive card that is temporarily unavailable. disabled is the card's own state: the card stops activating and shows a not-allowed cursor, but the dimmed surface still passes clicks through, so disable any nested controls yourself (pass disabled to the buttons in the actions slot) to keep pointer and keyboard behavior identical.

Full width

Loading State ​

Show an animated loading indicator while content is being fetched. Use the loading state to provide visual feedback during async operations.

Full width

Interactive Cards ​

Set interactive to enable hover/active states, keyboard activation (Enter/Space), and typed activate events. Make a card interactive only when the whole card acts as a single action.

Interactive cards cannot host actions

role="button" makes the card's content presentational to assistive technology: a button or link inside an interactive card is unreachable for screen readers and an ARIA nested-interactive violation. A card with an actions slot is therefore a resting card whose actions do the work; a card that is itself one action carries no inner controls. When the card should navigate, prefer a real link in the header with a stretched hit area over interactive:

html
<ore-card elevation="2" style="position: relative">
  <ore-text slot="header" variant="heading" size="md">
    <a href="/article/1" style="text-decoration: none">Read the article</a>
  </ore-text>
  <ore-text>The whole card is clickable, but the accessible name is a real link.</ore-text>
</ore-card>

<style>
  /* The link paints its hit area across the card without wrapping the content. */
  ore-card a::after {
    content: '';
    position: absolute;
    inset: 0;
  }
</style>

This keeps right-click, open-in-new-tab, and copy-link working, and screen readers announce a link with the card's content as navigable structure.

Full width

Practical Examples ​

User Profile Card ​

Full width

Product Card ​

Full width

Status Card ​

Full width

Stats Card ​

Use the specialized ore-stats for labeled metrics, trends, icons, and compact visuals instead of rebuilding that structure from a generic card.

Full width

Horizontal Product List ​

Perfect for compact layouts and list views:

Full width

API Reference ​

Attributes ​

AttributeTypeDefaultDescription
variant'solid' | 'flat' | 'frost'N/AVisual style variant
color'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'N/AColor theme for the card
padding'none' | 'sm' | 'md' | 'lg' | 'xl'N/AInternal padding size
rounded'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full'N/ABorder radius size
elevation'0' | '1' | '2' | '3' | '4' | '5'N/AShadow elevation level (0=none, 5=maximum)
orientation'horizontal'N/ASide-by-side media + content layout
interactivebooleanfalseEnable hover/active states and activation
disabledbooleanfalseDisable card interaction
loadingbooleanfalseShow animated loading bar at the top

Slots ​

SlotDescription
(default)Main content area of the card
mediaMedia section (images/video) at the top
headerHeader section below media
footerFooter section at the bottom of the card
actionsAction buttons section (typically in footer)

Events ​

EventDetailDescription
clickN/ANative browser click (always available)
activate{ trigger: 'pointer' | 'keyboard', originalEvent: MouseEvent | KeyboardEvent }Emitted when an interactive card is activated

CSS Custom Properties ​

PropertyDefaultDescription
--card-bgvar(--color-canvas)Background color
--card-colorvar(--color-contrast-900)Text color
--card-bordervar(--border)Border width
--card-border-colorvar(--color-divider)Border color
--card-radiusvar(--rounded-lg)Border radius
--card-paddingvar(--size-4)Internal padding
--card-shadowvar(--shadow-sm)Box shadow
--card-hover-shadowvar(--shadow-md)Hover state shadow

Customization ​

Custom Styling ​

html
<ore-card
  style="
    --card-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-color: white;
    --card-radius: var(--rounded-2xl);
    --card-padding: var(--size-8);
  ">
  <ore-text slot="header" variant="heading" size="md">Custom Styled Card</ore-text>
  <ore-text>This card has custom colors and spacing.</ore-text>
</ore-card>

Custom Shadow ​

html
<ore-card
  style="
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --card-hover-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  "
  interactive>
  <ore-text slot="header" variant="heading" size="md">Enhanced Shadow</ore-text>
  <ore-text>Hover to see the custom shadow effect.</ore-text>
</ore-card>

Maintain color contrast requirements (WCAG 2.1 Level AA) when using custom --card-bg overrides.

Accessibility ​

The card component follows WCAG 2.1 Level AA standards. When interactive is set, role="button" is applied and aria-disabled reflects the disabled state. The aria-busy attribute reflects the loading state. Disabled cards receive tabindex="-1" and cannot receive focus. Tab moves focus to the card; Enter or Space activates it. Pressing Enter or Space on a nested control activates that control alone, never the card as well. Because role="button" makes the card's content presentational, an interactive card must not host buttons or links in its slots: see Interactive Cards. Content is organized using semantic HTML with named slots that screen readers can navigate in a logical hierarchy. Use semantic headings in the header slot to maintain proper document structure.