UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

16 lines (15 loc) 1.01 kB
import type { ReactNode } from "react"; import { type ClickableProps } from "../form/Clickable.js"; export interface MenuItemProps extends ClickableProps { /** * The first child becomes the link label (rendered inside the `<a>`). * - Any additional children form the submenu — only rendered when this item is "proud" (an ancestor of the current page). The caller is responsible for wrapping the submenu in a nested `<Menu>` if it wants the CSS `.menu .menu` descendant rules to apply. */ readonly children: ReactNode | [ReactNode, ...ReactNode[]]; } /** * A `<li>` containing an `<a>` link, plus optional submenu content shown when this item is "proud". * - Reads the current page URL from `<Meta>` and computes `active` / `proud` against its own `href`. * - Splits `children` into `[label, ...after]`: label goes inside the `<a>`; `after` is rendered as siblings below it, only when proud. */ export declare function MenuItem({ href, children, ...props }: MenuItemProps): ReactNode;