shadcn-templ

Aspect Ratio

Displays content within a desired ratio.

Photo by Drew Beamer
templ
templ AspectRatioDemo() {
	<div class="w-[350px]">
		@ui.AspectRatio(16.0/9.0, "overflow-hidden rounded-md bg-muted", nil) {
			<img
				src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
				alt="Photo by Drew Beamer"
				class="h-full w-full object-cover"
			/>
		}
	</div>
}