
A CSS aspect-ratio wrapper component for maintaining consistent proportions.
npx shadcn@latest add https://ui.edbn.me/api/analytics/registry/aspect-ratio.jsonNative CSS aspect-ratio wrapper. Renders a div element and forwards its ref.
rationumber1Width-to-height ratio passed to the CSS aspect-ratio property.
classNamestringCSS class name merged onto the root element.
styleReact.CSSPropertiesInline styles merged after the ratio style, allowing explicit overrides.
childrenReact.ReactNodeContent rendered inside the ratio box.
refReact.Ref<HTMLDivElement>Forwarded to the root div element.
...propsReact.ComponentPropsWithoutRef<'div'>All native div attributes are supported.
| Attribute | Description |
|---|---|
| data-slot="aspect-ratio" | Identifies the root slot for styling and inspection. |