Aspect Ratio

Live Demos Hub
GitHub ↗

Aspect Ratio

Interactive production-grade hypermedia component for HTMXUI.

Interactive Preview

{content}

HTML Source

<!-- 
  Component: aspect-ratio.html
  Configurable State: themeColor ('primary'|'secondary'|'destructive'), size ('sm'|'md'|'lg'), isOpen (boolean)
  Usage: Bind styles dynamically using hx-class="{ 'bg-primary': themeColor === 'primary' }" or hx-style="{ width: size === 'lg' ? '100%' : 'auto' }"
-->
<div hx-ext="reactive" hx-state="{ themeColor: \'primary\', size: \'md\', isOpen: false }"  class="relative w-full" style="padding-bottom: {ratio_percent}%;">
  <div class="absolute inset-0">
    {content}
  </div>
</div>