easeul

Radix UIKeyframes

Dropdown menu

Same attribute contract as Popover. One rule covers every menu surface Radix ships.

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.

withoutno attribute
with easefuldata-motion="scale-fade"
host writes

data-state, data-side

easeful matches

[data-motion~="scale-fade"][data-state="closed"]

what runs

animation: motion-exit 150ms

you write

<DropdownMenu.Content data-motion="scale-fade" />

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.

  1. DropdownMenu.Root
  2. DropdownMenu.Trigger
  3. DropdownMenu.Portal
  4. DropdownMenu.Contentdata-motion="scale-fade"

Source

"use client"

import { DropdownMenu } from "radix-ui"
import type { DemoProps } from "@/components/demos/props"

export function RadixDropdownMenu({ motion }: DemoProps) {
  return (
    <DropdownMenu.Root>
      <DropdownMenu.Trigger className="btn">Open menu</DropdownMenu.Trigger>
      <DropdownMenu.Portal>
        <DropdownMenu.Content className="menu" sideOffset={10} collisionPadding={16} data-motion={motion}>
          <DropdownMenu.Item className="menu__item">Rename</DropdownMenu.Item>
          <DropdownMenu.Item className="menu__item">Duplicate</DropdownMenu.Item>
          <DropdownMenu.Item className="menu__item">Archive</DropdownMenu.Item>
        </DropdownMenu.Content>
      </DropdownMenu.Portal>
    </DropdownMenu.Root>
  )
}
The whole file, read from disk at build time. Both copies above render from it, and the motion prop is the only difference between them.