Frame

A component layout that acts like a box with a fixed aspect ratio content. It clips overflow, aligns content with --frame-align / --frame-justify, and stretches a direct <img> or <video> to fill.

Aspect-ratio container. Images, video, and anything else that should maintain a fixed ratio regardless of content. Default is 16:9. Children are centered by default.

Examples

16:9
1:1
<div class="cluster">
    <div class="frame box is-bordered" style="--frame-ratio: 16/9; inline-size: 24rem">
        <span>16:9</span>
    </div>
    <div class="frame box is-bordered" style="--frame-ratio: 1; inline-size: 12rem">
        <span>1:1</span>
    </div>
</div>

Reference

Source: src/css/composition.css

Applies to

.frame

Slots

SlotDescription
.frame > img, .frame > videoImage and video elements inside a frame are set to fill the frame by default.

Tokens

TokenDefaultDescription
--frame-ratio16 / 9Aspect ratio for the frame
--frame-aligncenterVertical alignment of frame content
--frame-justifycenterHorizontal alignment of frame content