Card for image-forward or custom content that forms one destination. It builds on Container with the card material, a medium rounded shape, and optional top and bottom gradient scrims that keep overlaid text legible across varied imagery.CardAboveScrim and CardBelowScrim identify whether content paints above or below the scrim.import {
Card,
CardAboveScrim,
CardBelowScrim,
ScrimType,
TextStyle,
TextView,
} from '@wearables-ui-toolkit/mrbd';
export function StoryCard({ story, onOpen }: StoryCardProps) {
return (
<Card
ariaLabel={story.title}
bottomScrim={ScrimType.TALL}
clickable
onActivate={onOpen}
>
<CardBelowScrim>
<img className="story-image" src={story.image} alt="" aria-hidden="true" />
</CardBelowScrim>
<CardAboveScrim>
<div className="story-caption">
<TextView textStyle={TextStyle.BODY2_EMPHASIZED}>{story.title}</TextView>
</div>
</CardAboveScrim>
</Card>
);
}
.story-image {
width: 100%;
height: 100%;
object-fit: cover;
}
.story-caption {
padding: var(--uit-spacing-large);
}
import { Card, ScrimType } from '@wearables-ui-toolkit/mrbd';
<Card interactive={false} topScrim={ScrimType.MEDIUM}>
<StatusArtwork />
</Card>;
Card, both scrim layer components, and ScrimType are also available from the component subpath:import {
Card,
CardAboveScrim,
CardBelowScrim,
ScrimType,
} from '@wearables-ui-toolkit/foundation/components/Card';
CardProps. It extends Container props, which extend InteractableBase props. The material, shape, interaction, and tooltip props documented on those pages are available to Card. The component forwards remaining props and a ref to the card root.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Card content. Children not wrapped in CardAboveScrim paint below the scrim. |
topScrim | ScrimType | ScrimType.NONE | Gradient scrim size measured from the top edge. |
bottomScrim | ScrimType | ScrimType.NONE | Gradient scrim size measured from the bottom edge. |
| Prop | Type | Default | Description |
|---|---|---|---|
material | ContainerMaterial | the card material | Material painted behind and in front of the content. |
shapeProvider | ShapeProvider | rounded rectangle at the medium corner radius | Geometry used for content clipping and every material path. |
width | number \| string | 'auto' | CSS width. A number represents pixels. |
height | number \| string | 'auto' | CSS height. A number also seeds the FULL scrim before measurement. |
clipContent | boolean | true | Clips the content subtree to the card shape. |
interactive | boolean | true | Default value for focusable, pressable, and clickable. |
focusable / pressable / clickable | boolean | value of interactive | Individual interaction capability switches. |
disabled | boolean | false | Blocks activation while keeping the card focusable. |
onActivate | (event: InteractableActivationEvent) => void | — | Card action. Fires once for each pointer or keyboard activation. |
onClick | MouseEventHandler | — | Raw DOM click handler for pointer and compatibility activation. |
onStateChange | (prev: InteractionState, next: InteractionState) => void | — | Called after the card applies an interaction state change. |
ariaLabel | string | — | Accessible name for the card. |
tabIndex | number | 0 | Tab index applied while the card is focusable. |
contentScaleForStateFn | (state: State, containerSize: {width: number; height: number}) => number | — | Replaces content scaling for each state. |
visualStateOverride | VisualState | — | Fixes the material’s rendered visual state instead of deriving it from interaction. |
className | string | '' | Class added to the card root. |
style | CSSProperties | — | Inline styles applied to the card root. |
CardAboveScrim and CardBelowScrim use the exported CardScrimLayerProps type. Both forward a ref to their wrapper div.| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Content placed in the selected layer. |
className | string | '' | Class added to the layer wrapper. |
style | CSSProperties | — | Inline styles applied to the layer wrapper. |
ScrimTypeNONE — no scrimSMALL — the shortest fixed gradientMEDIUM — the middle fixed gradientTALL — the tallest fixed gradientFULL — a gradient spanning the card’s measured heightCard first paints children that are not wrapped in CardAboveScrim, then paints the scrim, and finally paints CardAboveScrim children. DOM order controls stacking within each group; the component adds no per-child offset. CardBelowScrim is optional and makes the default layer explicit.CardAboveScrim directly under Card; wrapping it in another element, putting it in a fragment, or importing it from a duplicate package copy moves it into the below-scrim group. This direct composition is required for correct text layering.SMALL, MEDIUM, and TALL use fixed gradient heights. FULL uses the measured card height, then a numeric height prop, then a built-in fallback height before the first measurement. Measurement stays live, so a FULL scrim follows responsive card resizing. Each gradient holds a three-quarter-opacity black band across the first fifth of its height from its edge, then fades to transparent at the opposite end. Top and bottom scrims can appear together in one decorative layer. When both values are NONE, Card renders no scrim layer.material from the material library and retain it with useMemo. Each mounted card must own a distinct material instance; mounting one material on two cards at the same time throws.Card is focusable, pressable, and clickable by default because interactive defaults to true. The root is always a div. A clickable card receives a button role unless the caller provides another role. Use interactive={false} for a presentational card. Consider changing one of focusable, pressable, or clickable only when the interaction model needs a specific capability.medium corner radius. A different ShapeProvider updates the content clip and every material fill and stroke path together. This keeps media aligned with custom geometry, such as a tail shape.Card stacks content in a layer that fills the card, so content does not create an intrinsic card size. Set width and height, or let a parent grid cell or stretched flex item size the card. The component writes its size inline, so class-based width and height do not take effect; use the props or style. Prefer values derived from available space instead of a fixed Meta Ray-Ban Display size. Provide a numeric height when a FULL scrim must be correct on the first paint.ariaLabel or aria-label that describes the activation result.onActivate for the card action so pointer and keyboard activation each invoke it exactly once.alt and aria-hidden="true" so assistive technology does not announce redundant content.aria-hidden.interactive={false} when the card has no action so it does not expose a button role or enter the tab order.CardBelowScrim, and place text or glyphs that depend on the scrim in CardAboveScrim.CardAboveScrim directly under Card; wrappers prevent the component from recognizing the above-scrim layer.