Branched menu
A branched tree menu whose parent rows unfold their children with a small quarter-arc branch drawn from the trunk to the row.
Implementation
1"use client";2 3import { useMemo, useState, type CSSProperties, type ReactNode } from "react";4 5export interface BranchedMenuChild {6 value: string;7 label: string;8 icon?: ReactNode;9}10 11export interface BranchedMenuItem {12 label: string;13 value?: string;14 children?: BranchedMenuChild[];15}16 17export interface BranchedMenuProps {18 items?: BranchedMenuItem[];19 defaultOpen?: number | number[];20 defaultActive?: string;21 onSelect?: (22 value: string,23 item: BranchedMenuChild | BranchedMenuItem,24 ) => void;25 onToggle?: (index: number, open: boolean) => void;26 color?: string;27 accentColor?: string;28 lineColor?: string;