Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface LayoutNavigationState<T>

Type parameters

Hierarchy

  • TreeItemSelection
  • TreeItemExpansion
    • LayoutNavigationState

Index

Properties

expandedIds: ExpandedIds

The list of expanded ids within the tree. These ids should reference itemIds for tree items.

linkComponent: ElementType<any>

The link component to use when a nav item is clicked. This defaults to the Link component from @react-md/link, but can also be a Link from react-router or another routing library.

multiSelect?: boolean

Boolean if multiple items within the tree can be selected at once.

The navigation items to use that will be passed to the Tree component from @react-md/tree

onMultiItemExpansion: Dispatch<SetStateAction<ExpandedIds>>

A function to call when the user presses the asterisk key (*) that will expand all tree items at the same level as the currently focused item.

remarks

@since 4.0.1 Allows for callback behavior to get current expandedIds.

selectedIds: SelectedIds

The list of selected ids within the tree. If you only want to allow a single item to be selected at a time within a tree, keep this as either an empty list (no selections) or a single itemId.

Methods

  • onItemExpansion(itemId: string, expanded: boolean): void
  • A function to call that will update the expandedIds to collapse or expand a clicked item.

    Parameters

    • itemId: string
    • expanded: boolean

    Returns void

  • onItemSelect(itemId: string): void
  • A function to call that will update the selectedIds to include itemId of the newly selected tree item. This will be triggered when:

    • the user clicks a tree item with mouse or touch
    • user presses the space or enter key while keyboard focusing a tree item

    Note: If you are using the useTreeItemSelection hook, this will always cause the selectedIds to be a list of just the selected itemId unless the multiSelect (second argument) is enabled.

    Parameters

    • itemId: string

    Returns void

  • onMultiItemSelect(itemIds: SelectedIds): void
  • A function to call that will update the selectedIds for "batch" selection updates. This will always be called with a unique list of itemIds that contained the previous itemIds including the new itemIds. This will only be called when the multiSelect prop has been enabled and:

    • the user Shift + Clicks items within the tree
    • triggers "select-to" keyboard functionality with Control+Shift+Home or Control+Shift+End

    Parameters

    • itemIds: SelectedIds

    Returns void

Generated using TypeDoc