Aspect Ratio

Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.

A house in a forest
<AspectRatio ratio={16 / 8}>
<img src="https://images.unsplash.com/photo-1479030160180-b1860951d696?&auto=format&fit=crop&w=1200&q=80" alt="A house in a forest" style={{ "object-fit": "cover", "width": "100%", "height": "100%", "border-radius": "var(--radius-2)" }} />
</AspectRatio>

API Reference

This component inherits props from the Aspect Ratio primitive.