Aspect ratio: Broken image
When the image fails, the browser’s broken-image glyph is hidden and a fallback icon is shown instead. Pass fallback to replace it, or fallback={null} to show nothing.


This adds the example as components/examples/aspect-ratio/broken-image.tsx, together with the Aspect ratio component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/aspect-ratio-broken-image.jsonTo add only the component, follow the Aspect ratio installation.
Props in this example
The Aspect ratio props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
ratio | number | `${number}/${number}` | `${number}:${number}` | 1 |
fallbackShown when the media fails. null shows nothing. | ReactNode | <IconPhotoOff /> |
Every prop is in the Aspect ratio API reference.
- Ratios
- Slow load
- Overlay
- Without placeholder
- Responsive
- Inside a centered flex column
- Text content
- As a figure
- Invalid ratio
- Right to left
See them all, with keyboard support and accessibility notes, on the Aspect ratio page.
- SkeletonPlaceholders that wait 150ms before showing, take the exact size of the content they wrap, and fade it in without moving anything.
- AccordionStacked headings that each reveal a panel, with height motion you can reverse mid-way and panels that stay searchable while closed.
- CarouselNative scroll-snap slides with momentum on touch, mouse dragging, arrow keys, dots, thumbnails and an autoplay that pauses when it should.
- CollapsibleA panel that shows and hides with height motion you can reverse mid-way, without jumping the layout.
- ResizablePanels you can drag apart, with a quiet divider that wakes up on hover, sizes that glide on reset or collapse, and layouts that persist.
- Scroll areaNative scrolling with a minimal scrollbar, edges that fade only where there’s more to see, and an optional peek that cuts the last item in half.