Menu

Menu is the standalone menu surface, for a context menu or a panel that is not attached to a trigger.

Installation

Nothing to add. This component ships as source in your download, so it is already in your project.

Filesrc/vui/menu.tsx
Import from@viliha/vui-react/menu

The exported names are at the top of that file. The import path is an alias the download's tsconfig.json points at src/vui/, so you can move that folder and change one line rather than every file that imports from it.

Usage

menu-demo.tsx
import { Menu, MenuItem, MenuLabel } from "@viliha/vui-react/menu";

Exports

Everything this family exports. They are read from the source, so this list is what the package actually ships.

PropTypeDefault
Menucomponent—
MenuItemcomponent—
MenuLabelcomponent—

It takes no props of its own. Everything you pass reaches the underlying React.HTMLAttributes<HTMLDivElement> primitive, so every attribute it accepts works here unchanged and nothing is invented on top.

Plus everything React.ButtonHTMLAttributes<HTMLButtonElement> accepts, passed straight through to the underlying element.

PropTypeDefaultWhat it does
as?React.ElementType—Render as a different element (e.g. a framework `<Link>`); default button.
href?string—
PropTypeDefault
className?string—
childrenReact.ReactNode—

Customize

Every value this component draws comes from the theme: the colours, the radius, the control height and the type scale. Change a token and this moves with everything else, which is the difference between theming the product and overriding a component. See Theming for the token contract, and Swapping defaults for replacing the markup itself.