PyBlade/ui
Menu⌄
DocsComponentsAspect ratio

Aspect ratio

Keeps its content at a given ratio.

1 file

Installation

pyblade-ui add aspect-ratio

Usage

The tag <pb-ui.aspect-ratio> is available in all your templates.

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

Examples

Square

Props

PropDefault
ratio'16 / 9'

Any other attribute (class, id, x-on:click, hx-post…) is passed to the root element; your Tailwind classes win over the component's.