Your wealth,
finally working.

The AI finance app that tracks your spending and tells you what to do next.

Layered menu

A burger that opens a full-frame menu of four coloured panels dropping in turn.

Behaviour

  • Reduced motion: the panels and links fade, nothing slides or blurs.
  • Four panels drop from the top in turn; the front one carries the links, which fade up out of a blur one after another.
  • The burger turns into an X and a Close label slides in; both are cream over the panels (`activeColor`) and take `color` while shut. Closing runs the panels back up, front one first.
  • Escape or picking a link closes it (the Escape is the menu's: a dialog around it stays open). Focus moves into the menu and returns to the burger; Tab stays inside while it is open.
  • Locks page scroll while open (not when contained). The front panel is a dialog.
  • The layout follows the width of the frame it fills, not the screen: two columns from 48rem, one below.

Props

PropTypeDescription
primaryMenuLink[]The big links on the right. A link is { label, href }.
secondaryMenuLink[]default []The smaller list on the left.
legalMenuLink[]default []Small print under the secondary list; hidden when the menu is narrower than 48rem.
colors[string, string, string, string]default Armour's fourPanel colours, back to front. The last one carries the links.
logoReactNodeCentred at the top of the open menu.
colorstringdefault #F4F1DEBurger and Close colour while the menu is shut: set it to suit the page behind.
activeColorstringdefault #F4F1DETheir colour while the menu is open, over the panels.
containedbooleandefault falseFill the nearest relative parent instead of the screen.
defaultOpenbooleandefault falseStart open.
openbooleanControlled state, with onOpenChange.
delaynumberdefault 1.62Seconds before the burger lines draw in on first paint.
classNamestringClasses for the burger button's position.

Installation

npx shadcn@latest add https://purrfectui.com/r/layered-menu.json

How to use

import { LayeredMenu } from "@/components/ui/layered-menu";

<section className="relative h-screen">
  <LayeredMenu
    logo="ARMOUR"
    primary={[{ label: "Experience", href: "#experience" }]}
    secondary={[{ label: "FAQ", href: "#faq" }]}
  />
</section>

Source code

Loading…

Credits

Ported from armour.vaibhavtomar.com.

License

MIT. Copy it into your project and change it as you like.

0