Ship faster with goilerplate templUI Pro

Aspect Ratio

A component for maintaining consistent width-to-height ratios across different screen sizes.

Source Tailwind CSS

Example image

Installation

templui add aspectratio

API Reference

Required parameter
Hover for description

AspectRatio

Component for maintaining consistent width-to-height ratios across different screen sizes.

Name Type Default
ID

Unique identifier for the aspect ratio element.

string
-
Class

Additional CSS classes to apply to the aspect ratio container.

string
-
Attributes

Additional HTML attributes to apply to the aspect ratio element.

templ.Attributes
-
Ratio

Aspect ratio preset. Options: 'auto', 'square', 'video', 'portrait', 'wide'.

Ratio
auto
Axel Adrian