跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.twenty.com/llms.txt

Use this file to discover all available pages before exploring further.

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.
src/navigation-menu-items/example-navigation-menu-item.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:
    类型作用Required 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.
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.