Aspect Ratio
Displays content within a desired ratio.
import { Component } from '@angular/core';
import { HlmAspectRatioDirective } from '@spartan-ng/ui-aspectratio-helm';
@Component({
selector: 'spartan-aspect-ratio-preview',
standalone: true,
imports: [HlmAspectRatioDirective],
template: `
<div class="max-w-xl overflow-hidden rounded-xl drop-shadow">
<div [hlmAspectRatio]="16 / 9">
<img alt="Mountain views" src="/mountains.jpg" />
</div>
</div>
`,
})
export class AspectRatioPreviewComponent {}
Installation
npx nx g @spartan-ng/cli:ui aspectratio
ng g @spartan-ng/cli:ui aspectratio
Usage
import { HlmAspectRatioDirective } from '@spartan-ng/ui-aspectratio-helm';
<div class="max-w-xl overflow-hidden rounded-xl drop-shadow">
<div [hlmAspectRatio]="ratio">
<img alt="Mountain views" src="/mountains.jpg" />
</div>
</div>