---
title: Aspect Ratio
description: Displays content within a desired ratio.
component: true
links:
doc: https://www.radix-ui.com/docs/primitives/components/aspect-ratio
api: https://www.radix-ui.com/docs/primitives/components/aspect-ratio#api-reference
source:
radix: true
shadcn: true
---
## Installation
CLI
Manual
```bash
npx shadcn-ui@latest add aspect-ratio
```
Install the following dependencies:
```bash
npm install @radix-ui/react-aspect-ratio
```
Copy and paste the following code into your project.
Update the import paths to match your project setup.
## Usage
```tsx
import Image from 'next/image'
import { AspectRatio } from '@/components/ui/aspect-ratio'
```
```tsx
```