Skip to main content

Dynamic Menu

Dynamic menu is created by utilizing data structures such as arrays or objects to represent the menu items and render the data using a loop facilitates. This approach allows you to generate the menu components dynamically based on the data you provide, making it easier to manage and update the menu items programmatically.This allows for greater flexibility in managing the menu content and adapting it to changing requirements.

Props

export type VerticalMenuDataType = VerticalMenuItemDataType | VerticalSubMenuDataType | VerticalSectionDataType

export type VerticalMenuItemDataType = Omit<VerticalMenuItemProps, 'children'> & { label: ReactNode }
export type VerticalSubMenuDataType = Omit<VerticalSubMenuProps, 'children'> & { children: VerticalMenuDataType[] }
export type VerticalSectionDataType = Omit<VerticalMenuSectionProps, 'children'> & {
isSection: boolean
children: VerticalMenuDataType[]
}

You may refer to the VerticalMenuItemProps, VerticalSubMenuProps and VerticalMenuSectionProps for more information on the props.

Example

/vertical-menu/menu-render/dynamic-menu

Source Code