---
title: "Expand on Hover"
description: "A row of photo strips. The one under the pointer grows to show its whole photo and title. On a phone the strips stack, and a tap opens one."
url: https://gelatinui.com/components/expand-on-hover
markdown_url: https://gelatinui.com/components/expand-on-hover.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/expand-on-hover"
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Expand on Hover

> A row of photo strips. The one under the pointer grows to show its whole photo and title. On a phone the strips stack, and a tap opens one.

Page: https://gelatinui.com/components/expand-on-hover

## When to use it

Best for: Three to six photos with a short title each, where one at a time shows in full.

- Give each `ExpandOnHoverItem` a `value`, and the root a `defaultValue`, so one item is open at rest.
- Put the picture in `ExpandOnHoverMedia`, the closed title in `ExpandOnHoverLabel`, and the open text in `ExpandOnHoverContent`.
- Render a link with `render={<a href="…" />}` for an item that goes somewhere.
- Leave `orientation` on `"auto"`: when a closed strip would be under 44px, as on a phone, the strips stack into bands, and a tap opens one.

## When not to use it

- For panels of text that open and close, use [Accordion](https://gelatinui.com/components/accordion.md).
- For many photos that a person swipes through, use [Carousel](https://gelatinui.com/components/carousel.md).

## Notes for agents

- Give the root a height: `h-96` by default, `h-112` vertical. A column is never shorter than 44px per closed band.
- `orientation="auto"` (default) reads the root width, not the window: 7 strips stay a row from 532px up.
- The first hover in the row opens after a 60ms rest; later hovers and focus open at once.
- The open item stays open when the pointer leaves the row.
- On touch, the first tap opens a closed item and does not follow its link; a tap on the open item does.
- `openSize` (default 5) is how many closed items the open item is as wide as.
- Do not put links or buttons inside an item: the item is one control.
- The strips grow with `flex-grow` on a spring; the content is laid out once at the open size, so the text never wraps.

## Anatomy

```text
ExpandOnHover
├─ ExpandOnHoverItem (0..n)
├─ ExpandOnHoverMedia (0..n)
├─ ExpandOnHoverLabel (0..n)
└─ ExpandOnHoverContent (0..n)
```

## API reference

### ExpandOnHover

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` | "default" |  |
| `orientation` | `"auto" \| ExpandOnHoverOrientation` | "auto" | `auto` (the default): a row while each closed strip is at least 44px wide, else a column of bands, as on a phone (a tap opens one band, which grows down). `horizontal` and `vertical` keep one layout. A column is at least 44px per closed band tall, whatever its height class. |
| `value` | `string \| null` |  | The open item (controlled). `null`: no item is open, and all items share the row evenly. |
| `defaultValue` | `string \| null` | null | The open item at first (uncontrolled). Default `null`. |
| `onValueChange` | `function` |  | Called when hover, focus, or a tap opens another item, with the Base UI change details (reason `"none"`: the hover intent opens it after its rest, not on an event of its own). |
| `openSize` | `number` | 5 | How many closed items the open item is as wide (or tall) as. Default 5. |
| `disabled` | `boolean` | false | No item opens; the open item stays open. |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

### ExpandOnHoverItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` |  | The value that names this item in `value`, `defaultValue`, and `onValueChange`. |
| `disabled` | `boolean` | false | This item never opens and leaves the Tab order. |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

### ExpandOnHoverMedia

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### ExpandOnHoverLabel

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### ExpandOnHoverContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| ExpandOnHover | `expand-on-hover` | `data-disabled`, `data-open`, `data-status` | `--expand-on-hover-gap`, `--expand-on-hover-grow`, `--expand-on-hover-open`, `--expand-on-hover-open-size`, `--expand-on-hover-progress`, `--expand-on-hover-scrim` |  |
| ExpandOnHoverItem | `expand-on-hover-item` | `data-disabled`, `data-open`, `data-status` | `--expand-on-hover-gap`, `--expand-on-hover-grow`, `--expand-on-hover-open`, `--expand-on-hover-open-size`, `--expand-on-hover-progress`, `--expand-on-hover-scrim` |  |
| ExpandOnHoverMedia | `expand-on-hover-media` | `data-disabled`, `data-open`, `data-status` | `--expand-on-hover-gap`, `--expand-on-hover-grow`, `--expand-on-hover-open`, `--expand-on-hover-open-size`, `--expand-on-hover-progress`, `--expand-on-hover-scrim` |  |
| ExpandOnHoverLabel | `expand-on-hover-label` | `data-disabled`, `data-open`, `data-status` | `--expand-on-hover-gap`, `--expand-on-hover-grow`, `--expand-on-hover-open`, `--expand-on-hover-open-size`, `--expand-on-hover-progress`, `--expand-on-hover-scrim` |  |
| ExpandOnHoverContent | `expand-on-hover-content` | `data-disabled`, `data-open`, `data-status` | `--expand-on-hover-gap`, `--expand-on-hover-grow`, `--expand-on-hover-open`, `--expand-on-hover-open-size`, `--expand-on-hover-progress`, `--expand-on-hover-scrim` |  |

## Usage

Give each item a value, a picture, a label, and the open text.

The sample also uses `image`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui-pro/expand-on-hover @gelatin-ui/image
```

```tsx title="trip-days.tsx"
import {
  ExpandOnHover,
  ExpandOnHoverContent,
  ExpandOnHoverItem,
  ExpandOnHoverLabel,
  ExpandOnHoverMedia,
} from "@/components/pro/media/expand-on-hover";
import { Image } from "@/components/ui/image";

const days = [
  { id: "lake", title: "Turquoise lake", photo: "/lake.webp" },
  { id: "hills", title: "Misty hills", photo: "/hills.webp" },
  { id: "falls", title: "Waterfall trail", photo: "/falls.webp" },
];

export function TripDays() {
  return (
    <ExpandOnHover defaultValue="lake">
      {days.map((day) => {
        return (
          <ExpandOnHoverItem key={day.id} value={day.id}>
            <ExpandOnHoverMedia>
              <Image src={day.photo} alt="" fill />
            </ExpandOnHoverMedia>
            <ExpandOnHoverLabel>{day.title}</ExpandOnHoverLabel>
            <ExpandOnHoverContent>
              <span className="text-2xl font-semibold">{day.title}</span>
            </ExpandOnHoverContent>
          </ExpandOnHoverItem>
        );
      })}
    </ExpandOnHover>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/expand-on-hover
```

It adds 22 registry items: 21 files, 3510 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Accordion](https://gelatinui.com/components/accordion.md)
- [Carousel](https://gelatinui.com/components/carousel.md)
- [Image](https://gelatinui.com/components/image.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves to the next strip and opens it. |
| Enter, Space | Opens the focused strip. On a link strip, Enter follows the link. |

## Accessibility

Each item is one button (or the link you render), named by its Label, with `aria-expanded` on the open state.

The open text describes the open item. Screen readers and the Tab key skip it while the item is closed.

Give a Media-only item an `aria-label`.

## Motion

| Part | Motion |
| --- | --- |
| Open | glide · spring (stiffness 700, damping 53), the open strip grows as the others shrink, with no overshoot |
| Text | glide · the label fades out in the first 30% of the open; the content fades in and rises 8px in the second half |
