A menu that lifts what you press above the page.
Press and hold an item to lift it above a blurred page, with a menu next to it. Keep your finger down and slide onto an option to pick it in one motion, or let go and tap through the menu afterward. Right-click and the keyboard open it too.
Hold a message
Installation#
Install the package from your command line.
pnpm add repousseCreate a Repousse#
Compose the parts. The menu stays out of the page until a press opens it.
message.tsx
import { Repousse } from "repousse/react";
export function Message() {
return (
<Repousse.Root>
<Repousse.Trigger>Are we still on for dinner?</Repousse.Trigger>
<Repousse.Overlay />
<Repousse.Menu className="menu">
<Repousse.Item onSelect={() => console.log("reply")}>Reply</Repousse.Item>
<Repousse.Item onSelect={() => console.log("copy")}>Copy</Repousse.Item>
</Repousse.Menu>
</Repousse.Root>
);
}Style it#
repousse ships no CSS, so the blur, the shadow and the menu's look are yours. The overlay and the lifted copy are made for you, so style them by their data attributes.
[data-repousse-overlay] {
z-index: 60;
background: rgb(0 0 0 / 0.25);
backdrop-filter: blur(10px);
}
[data-repousse-lifted] {
z-index: 61;
box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
}
.menu {
z-index: 62;
background: white;
border-radius: 14px;
}The z-indices only matter if the page has z-indexed content of its own. Set all three together, or the overlay covers the rest.