MediaFrame
A rounded clip frame for media (image or video). Establishes a
relative overflow-hidden positioning context and clips its single child to a
rounded corner - but it is a dumb box: it does NOT size or cover-fill the
child. Give it one media child with size-full object-cover (identical
contract to AspectRatio). Radius, size, and positioning all come from the
className you pass (rounded-2xl, size-full, absolute inset-0, …) -
there is no radius prop.
Extracted from the product-card and editorial-card media frames; available to
any composition that needs a rounded overflow-clip layer.
Usage
Best practices
MediaFrame is a dumb clip box - it does not size or cover-fill the child; give it one media child with
size-full object-cover, like AspectRatio.Set radius, size, and positioning through
className(rounded-3xl,size-full,absolute inset-0) - there is noradiusprop.Use
asto change the element (a tag); userenderonly to swap in a component (e.g. a router Link). Neverrender={<Box as=…/>}- passasdirectly.Set
edgeto frame photography with an inset hairline that stays above the media; do not fake it with a border or an inset shadow on the frame, which the media hides.Reach for
raisedonly when the frame sits on the same fill as its surface; in a dense row the edge already separates it.
Props
MediaFrame
MediaFrameEmbed
Also exports
- interface
MediaFrameEmbedProps - interface
MediaFrameProps
Composition
Used by