Styling

The same parts, in any look.

repousse ships no CSS. Each part takes your own classes, and the lifted copy brings the trigger's look with it. Here's one menu in five styles.

Site#

The look of this site. The trigger and the menu share one color, so they read as a pair.

Q3 roadmap

Glass#

A translucent fill with backdrop-blur. It needs something colorful behind it, so the overlay only blurs a little.

Q3 roadmap

Neobrutalist#

Thick borders and a hard offset shadow. A custom clone keeps that shadow on the lifted copy.

Q3 roadmap

Terminal#

Monospace and sharp corners. A dark overlay with no blur suits it better.

$ q3-roadmap

Soft#

Large radii and a wide, diffuse shadow, over a heavily blurred overlay.

Q3 roadmap

Style the hooks#

The overlay takes classes when you render it. These selectors reach the rest.

SelectorWhat it is
[data-repousse-overlay]The overlay, including the one you don't render
[data-repousse-lifted]The lifted copy of the trigger
[data-highlighted]The item under a drag

Style [data-highlighted] along with :hover, since a drag doesn't hover.

<Repousse.Item className="hover:bg-neutral-100 data-highlighted:bg-neutral-100" />

The lifted copy#

The copy lands at the end of the page, so CSS scoped to the trigger's parents stops applying. The trigger's computed look is written onto it to make up for that, leaving out layout, motion and box-shadow.

Give it a shadow with [data-repousse-lifted]. That rule covers every menu on the page, so for one menu's own look, pass clone to build the copy yourself.

<Repousse.Trigger clone={(el) => el.cloneNode(true) as HTMLElement} />

Good to know#