Interface: MenuRenderContext
Defined in: components/Menu.tsx:146
Everything a custom renderMenu needs to draw the tree: the data, the
open/close state, and the same helpers the built-in styles use.
Exposing the helpers rather than just the categories is the point — URL
building respects getUrl/configuration, handleItemClick honours
onMenuItemClick, and the openPath helpers give working expand/collapse.
A custom renderer that only got categories would have to reimplement all
of that and would drift from the built-ins.
Properties
categories
categories:
MenuCategory[]
Defined in: components/Menu.tsx:148
Root-level categories of the fetched tree.
getCategoryName
getCategoryName: (
cat) =>string
Defined in: components/Menu.tsx:158
Localised display name.
Parameters
cat
Returns
string
getCategoryUrl
getCategoryUrl: (
cat) =>string
Defined in: components/Menu.tsx:160
Href honouring getUrl when provided, else configuration.urls.
Parameters
cat
Returns
string
getSubCategories
getSubCategories: (
cat) =>MenuCategory[]
Defined in: components/Menu.tsx:156
Children of cat, minus entries with no name or slug.
Parameters
cat
Returns
handleItemClick
handleItemClick: (
cat,e) =>void
Defined in: components/Menu.tsx:162
Click handler that fires onMenuItemClick and suppresses navigation.
Parameters
cat
e
MouseEvent
Returns
void
hasError
hasError:
boolean
Defined in: components/Menu.tsx:152
True when the internal fetch failed.
isLoading
isLoading:
boolean
Defined in: components/Menu.tsx:150
True while the internal fetch is in flight (never when tree is passed).
isOpenAt
isOpenAt: (
level,categoryId) =>boolean
Defined in: components/Menu.tsx:166
Is categoryId the open branch at level (0-based)?
Parameters
level
number
categoryId
number
Returns
boolean
maxDepth
maxDepth:
number
Defined in: components/Menu.tsx:154
Levels that may be rendered, after the style's cap is applied.
openAt
openAt: (
level,categoryId) =>void
Defined in: components/Menu.tsx:168
Open a branch at level, closing anything deeper. Pass null to close.
Parameters
level
number
categoryId
number | null
Returns
void
openPath
openPath:
number[]
Defined in: components/Menu.tsx:164
Currently open branch as category ids, root → deepest.
toggleAt
toggleAt: (
level,categoryId) =>void
Defined in: components/Menu.tsx:170
Toggle a branch at level — the accordion's click behaviour.
Parameters
level
number
categoryId
number
Returns
void