Guides
Navigation
Feedback
Overlays
Layout
Data Display
Forms
.md

Layout

aspect-ratio

Holds its children to a fixed width-to-height ratio.

16 / 9

Installation

php artisan ui:add aspect-ratio

Usage

<x-ui.aspect-ratio ratio="16/9" class="overflow-hidden rounded-lg">
    <img src="/photo.jpg" alt="" class="size-full object-cover" />
</x-ui.aspect-ratio>

No JavaScript and no tokens. Pass `ratio` as any CSS aspect-ratio value ("16/9", "1/1", "1.85"). Give the child `size-full object-cover` to fill the box.

Props

Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.

@props([
    'ratio' => '16/9',
])