Pallas UI
DocsComponents
Core Concepts
    • Introduction
    • Getting Started
    • Theming
    • Color Tokens
    • Spacing & Sizing
    • Layout Guide
    • AspectRatio
    • Box
    • Flex
    • Grid
    • Shapes
Previews
    • Accordion
    • Alert
    • Avatar
    • Badge
    • Breadcrumb
    • Button
    • Carousel
    • Checkbox
    • Combobox
    • Command
    • Date Picker
    • Form
    • Input
    • Input OTP
    • Label
    • MenuBar
    • Modal
    • Popover
    • Progress
    • Radio Group
    • Segmented
    • Select
    • Separator
    • Sheet
    • Sidebar
    • Skeleton
    • Slider
    • Spinner
    • Steps
    • Switch
    • Tabs
    • Textarea
    • Toast
    • Tooltip
    • Typography
  1. Layout
  2. AspectRatio

AspectRatio

A component that maintains a specific aspect ratio, regardless of the width.

This is particularly useful for images, videos, and other media content.

16:9 Aspect Ratio

Usage

import { AspectRatio } from '@styled-system/jsx'
<AspectRatio ratio={16 / 9} w="100%" maxW="500px">
  <img src="your-image.jpg" alt="Example" style={{ objectFit: 'cover' }} />
</AspectRatio>

Properties

AspectRatio accepts all the common layout properties plus:

NameTypeDefaultDescription
rationumber1The aspect ratio to maintain (width/height)

Examples

With Image

Nature landscape

Responsive

Responsive Aspect Ratio(Changes at different breakpoints)

Built with ❤️ by the carbonteq team. The source code is available on GitHub.

© 2025 Pallas UI. All rights reserved.