# Select

Host: Base UI. Path: transitions. Preset: `scale-fade`. Built against [@base-ui/react 1.5.0](https://www.npmjs.com/package/@base-ui/react/v/1.5.0).

Item state lives on the items, never on the popup, so nothing here can animate by accident.

The page this file mirrors mounts the component twice, once with the attribute and once without, so the only difference between the two is the library.

Upstream documentation: [Base UI documentation](https://base-ui.com/react/components/select)

The same component in other hosts: [Radix UI](/radix/select.md).

## Where the attribute goes

The parts this demo composes, and the value each one carries. Everything inside an animated part is that part's content, so the tree stops there.

```text
Select.Root
  Select.Trigger
    Select.Value
  Select.Portal
    Select.Positioner
      Select.Popup  data-motion="scale-fade"
```

## How the match works

| Step | Value |
| --- | --- |
| host writes | `data-ending-style, data-side` |
| easeful matches | `[data-motion~="scale-fade"][data-ending-style]` |
| what runs | `transition: opacity, scale 150ms` |
| you write | `<Select.Popup data-motion="scale-fade" />` |

## Every value that works here

Every value the manifest allows on this host, single presets and the pairs that compose. The first is what this component ships with. Both stages are the same component, so anything that changes between them is the attribute.

| Value | Link |
| --- | --- |
| `scale-fade` | the default |
| `fade` | [fade](/base-ui/select#motion=fade) |
| `slide-up` | [slide-up](/base-ui/select#motion=slide-up) |
| `fade slide-up` | [fade slide-up](/base-ui/select#motion=fade%20slide-up) |
| `scale-fade slide-up` | [scale-fade slide-up](/base-ui/select#motion=scale-fade%20slide-up) |

## Source

`apps/docs/components/demos/base-ui/select.tsx`

```tsx
"use client"

import { Select } from "@base-ui/react/select"
import type { DemoProps } from "@/components/demos/props"

export function BaseUiSelect({ motion }: DemoProps) {
  return (
    /* Select.Value renders nothing at all until something is selected, which is
     * why the trigger collapsed to an empty pill. It takes a placeholder. */
    <Select.Root>
      <Select.Trigger className="btn">
        <Select.Value placeholder="Pick a branch" />
      </Select.Trigger>
      <Select.Portal>
        <Select.Positioner sideOffset={10} collisionPadding={16}>
          <Select.Popup className="menu" data-motion={motion}>
            <Select.Item className="menu__item" value="main">
              <Select.ItemText>main</Select.ItemText>
            </Select.Item>
            <Select.Item className="menu__item" value="next">
              <Select.ItemText>next</Select.ItemText>
            </Select.Item>
            <Select.Item className="menu__item" value="canary">
              <Select.ItemText>canary</Select.ItemText>
            </Select.Item>
          </Select.Popup>
        </Select.Positioner>
      </Select.Portal>
    </Select.Root>
  )
}
```
