Aspect ratio

A React component in Beamline's Layout category, in the free sample.

Holds media, video and embeds at a fixed width-to-height ratio while the layout resizes.

Use it for

  • Media thumbnails, video frames and chart placeholders.

Not for

  • Text content (let it size itself).

Anatomy

  • outer box (sets the ratio)
  • inner box (fills it; your media goes here)

Variants

  • ratio: any number, e.g. 16/9, 4/3, 1

States

  • static

Keyboard

  • None.

Motion

None.

Props

PropTypeDefaultDescription
rationumber1Width divided by height.
style / refnative props—style: Inline styles on the documented visual root; no overrides by default. ref: Receives the documented native target or imperative handle; omitted by default.

Dependencies

@radix-ui/react-aspect-ratio

Import

import { AspectRatio } from "@beamline/aspect-ratio";

Get it

Aspect ratio is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Aspect ratio is included in the free MIT sample. Get Beamline · Connect your agent

More in Layout

  • Bezel: A double-bezel frame: an outer shell with a hairline, a small gap, and an inset panel with its own edge, so a preview, chart or media reads as set into…
  • Carousel: A row of slides that snap into place: swipe on touch, drag or the arrows with a mouse, ← → when focused, or the dots; optional autoplay that pauses and…
  • Card: A record or a small group of related content and actions: optional media, avatar, title, status, action, meta, free content and a Details toggle; plain…
  • Resizable panels: Panes that trade space across draggable dividers; each divider is a focusable separator with arrow keys, limits, folding for collapsible panes and…
  • UI root: Makes a region of any app a Beamline root: theme, brand and direction for everything inside, and a matching layer at page level where its menus, dialogs…
  • Expandable card: A dense card that grows in place when asked: the frame resizes and the clamped preview opens into the full text.
  • Accordion: Topics that open in place, one at a time or several: FAQs and settings sections; each header is a button (with an optional fact at its end), and the…
  • Collapsible: One region that opens and closes in place from its trigger, its height animating to the content.
  • Scroll area: A native scroll region with thin overlay thumbs and edge fades that show only where more content waits; thumbs can be dragged or clicked.
  • Direction: Sets left-to-right or right-to-left for everything inside: text and logical spacing flip, and Radix parts read the direction for keys and placement.
  • Separator: A hairline between groups, horizontal or vertical; hidden from screen readers unless it carries meaning.

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.