Skip to content

Add transitions to dropdowns and tooltips - #2887

Open
Arouraz wants to merge 1 commit into
livewire:mainfrom
Arouraz:dropdown-tooltip-transitions
Open

Arouraz wants to merge 1 commit into
livewire:mainfrom
Arouraz:dropdown-tooltip-transitions

Conversation

@Arouraz

@Arouraz Arouraz commented Nov 14, 2026

Copy link
Copy Markdown

The scenario

I noticed that dropdowns (both flux:menu and flux:navmenu) and tooltips just pop in and out, while modals, flyouts and toasts already have a nice little transition. Next to them, these overlays feel a bit abrupt. Most UI kits I've used animate them by default, and I think it would make Flux feel even more polished.

The proposal

Give dropdowns and tooltips a short transition by default, timed like the modal's, and add one prop that turns transitions off on any component that has them:

<flux:dropdown :transition="false">...</flux:dropdown>
<flux:tooltip :transition="false" content="Settings">...</flux:tooltip>
<flux:modal name="edit" :transition="false">...</flux:modal>
<flux:toast :transition="false" />

With prefers-reduced-motion: reduce, every one of these keeps its fade and drops its movement.

Since it's the default, dropdowns and tooltips start transitioning in every app after upgrading.

The solution

This is CSS only, plus the prop in five templates: dropdown, tooltip, modal, toast and toast.group. The prop renders data-flux-no-transition, the same way :dismissible="false" renders disable-click-outside.

  • Dropdowns and tooltips (flux:menu, flux:navmenu, flux:tooltip hover and toggleable) fade in and slide 4px away from their trigger. They use the modal's technique (@starting-style, plus allow-discrete on display and overlay) and its timings (0.15s in, 0.075s out). Submenus stay instant.
  • Modal, flyout and toast keep their current transitions.
  • Reduced motion removes the scale, slide and stacking motion everywhere, but keeps the fades. In a toast group, the JS slides each toast in and out with an inline transform, so that one is overridden with !important, only under reduced motion and only on the toast card. The stack positions are untouched.
  • The dropdown and tooltip rules are in @layer base, so transition-none and other utilities still override them. The opt-out only affects its own component: an opted-out modal leaves the dropdowns inside it alone.

The same approach can be extended to the Pro components that open a popover, like the date and time pickers, the listbox and combobox selects.

flux-transitions-before-after.mp4

Verification

Tested in Chrome, Firefox and Safari:

  • Dropdowns, navmenus and tooltips transition by default, and submenus open instantly
  • Modals, flyouts, toasts and toast stacks behave as before
  • Every component is instant with :transition="false"
  • With reduced motion, everything only fades

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant