Skip to main content

Aspect ratio

Keeps an image or video at a fixed shape while the layout resizes.

In Multi-brand

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Multi-brand: Media in cards or on product pages, held in shape while it loads. Not in empty states, which carry no brand pictures.

  • Use it when: Media in cards, galleries and heroes that must not stretch or jump while it loads.
  • Not when: Text content, or media that should keep its own natural shape.

Instead:

  • Skeleton: The placeholder shown while the media loads.

Words​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

See Voice and tone for the whole voice.

Use it in code​

npx open-ds add aspect-ratio

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Aspect ratio sets no colors, corners or shadows of its own; it takes them from the components inside it.