Skip to content

feat: add user_menu_links config for custom items in the user dropdown#2918

Open
nzjrs wants to merge 1 commit into
Chainlit:mainfrom
nzjrs:feat/user-menu-links
Open

feat: add user_menu_links config for custom items in the user dropdown#2918
nzjrs wants to merge 1 commit into
Chainlit:mainfrom
nzjrs:feat/user-menu-links

Conversation

@nzjrs
Copy link
Copy Markdown
Contributor

@nzjrs nzjrs commented May 4, 2026

Lets developers add links to the user menu, uses a similar paradigm to the way links can be added to the header.

Screenshot from 2026-05-04 20-39-05

The header has the symmetric header_links field; this adds the matching user_menu_links so the user menu is configurable too.

Each entry takes name, url, optional icon_url, optional display_name, and optional target (default _blank). icon_url is optional here (unlike HeaderLink, where it is required) because menu items are text-first; header items are icon-only buttons. Items render between the username label and the logout entry, with a separator inserted above logout when the list is non-empty. Each item uses Radix asChild over a real anchor, so middle-click and "open in new tab" behave correctly.

Backend: new UserMenuLink pydantic model, new optional UISettings field, and a commented example in the default config.toml template. Frontend: UserNav reads config.ui.user_menu_links via useConfig and resolves /public/... icon paths via ChainlitContext, matching the existing ButtonLink pattern.


Summary by cubic

Adds configurable user_menu_links so teams can add custom items in the avatar dropdown. Mirrors header_links to let you link to account, billing, or docs without code changes.

  • New Features
    • Backend: added UserMenuLink model and UISettings.user_menu_links, plus a commented example in the default config.toml.
    • Frontend: UserNav reads config.ui.user_menu_links via useConfig, renders items above Logout, resolves /public/... icons with ChainlitContext, and uses real anchors for proper new-tab behavior.
    • Types: extended @chainlit/react-client config types to include user_menu_links.

Written for commit 0b6cc76. Summary will update on new commits.

The avatar dropdown (UserNav) currently only shows the username and a
logout entry, with no way for operators to add account/billing/profile
links. The header has the symmetric `header_links` field; this adds the
matching `user_menu_links` so the user menu is configurable too.

Each entry takes name, url, optional icon_url, optional display_name,
and optional target (default _blank). icon_url is optional here (unlike
HeaderLink, where it is required) because menu items are text-first;
header items are icon-only buttons. Items render between the username
label and the logout entry, with a separator inserted above logout when
the list is non-empty. Each item uses Radix `asChild` over a real
anchor, so middle-click and "open in new tab" behave correctly.

Backend: new UserMenuLink pydantic model, new optional UISettings
field, and a commented example in the default config.toml template.
Frontend: UserNav reads config.ui.user_menu_links via useConfig and
resolves /public/... icon paths via ChainlitContext, matching the
existing ButtonLink pattern.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request frontend Pertains to the frontend. labels May 4, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend Pertains to the frontend. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant