Back to Twenty

Navigation Menu Items

packages/twenty-docs/developers/extend/apps/layout/navigation-menu-items.mdx

2.4.11.9 KB
Original Source

A navigation menu item is an entry in the left sidebar. Use defineNavigationMenuItem() to ship custom sidebar links — typically one per view you ship — or to point at external URLs.

ts
import { defineNavigationMenuItem, NavigationMenuItemType } from 'twenty-sdk/define';
import { EXAMPLE_VIEW_UNIVERSAL_IDENTIFIER } from '../views/example-view';

export default defineNavigationMenuItem({
  universalIdentifier: '9327db91-afa1-41b6-bd9d-2b51a26efb4c',
  name: 'example-navigation-menu-item',
  icon: 'IconList',
  color: 'blue',
  position: 0,
  type: NavigationMenuItemType.VIEW,
  viewUniversalIdentifier: EXAMPLE_VIEW_UNIVERSAL_IDENTIFIER,
});

Key points

  • type determines what the menu item links to. Each type pairs with a specific identifier field:

    TypeWhat it doesRequired field
    NavigationMenuItemType.VIEWOpens a saved viewviewUniversalIdentifier
    NavigationMenuItemType.LINKOpens an external URLlink
    NavigationMenuItemType.FOLDERGroups nested items under a labelname (and child items reference the folder via folderUniversalIdentifier)
    NavigationMenuItemType.OBJECTOpens an object's default index pagetargetObjectUniversalIdentifier
    NavigationMenuItemType.PAGE_LAYOUTOpens a standalone page layoutpageLayoutUniversalIdentifier
  • position controls ordering in the sidebar.

  • icon and color are optional and customize how the entry looks.

  • folderUniversalIdentifier is also available on any item to nest it inside a FOLDER-type parent.

<Note> **Common pitfall:** creating an object without an associated view + navigation menu item makes that object invisible to users. Unless it's a technical/internal object, every custom object should have a default view *and* a sidebar entry pointing at it. </Note>