AspectRatio
AspectRatio
Section titled “AspectRatio”[axAspectRatio] constrains its host to a fixed width-to-height ratio. It sets the modern
aspect-ratio CSS property (via Renderer2, SSR-safe), so any ratio works.
Import
Section titled “Import”import { AxAspectRatioDirective } from '@axisui-ng/primitives';<!-- 16:9 video wrapper (the default) --><div [axAspectRatio]="16 / 9"> <iframe src="…"></iframe></div>
<!-- square --><div [axAspectRatio]="1"> <img src="/cover.jpg" alt="Cover" /></div>Inputs
Section titled “Inputs”| Input | Type | Default | Notes |
|---|---|---|---|
axAspectRatio | number | 16 / 9 | Width ÷ height ratio (selector and input share this name). |
Accessibility
Section titled “Accessibility”Presentational only; provide proper alt/labels on the media inside it.
Storybook
Section titled “Storybook”Interactive examples live in Storybook under Primitives / AspectRatio. Run pnpm storybook to explore them.