feat: add user_menu_links config for custom items in the user dropdown#2918
Open
nzjrs wants to merge 1 commit into
Open
feat: add user_menu_links config for custom items in the user dropdown#2918nzjrs wants to merge 1 commit into
nzjrs wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets developers add links to the user menu, uses a similar paradigm to the way links can be added to the header.
The header has the symmetric
header_linksfield; this adds the matchinguser_menu_linksso 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
asChildover a real anchor, so middle-click and "open in new tab" behave correctly.Backend: new
UserMenuLinkpydantic model, new optionalUISettingsfield, and a commented example in the defaultconfig.tomltemplate. Frontend:UserNavreadsconfig.ui.user_menu_linksviauseConfigand resolves/public/...icon paths viaChainlitContext, matching the existingButtonLinkpattern.Summary by cubic
Adds configurable
user_menu_linksso teams can add custom items in the avatar dropdown. Mirrorsheader_linksto let you link to account, billing, or docs without code changes.UserMenuLinkmodel andUISettings.user_menu_links, plus a commented example in the defaultconfig.toml.UserNavreadsconfig.ui.user_menu_linksviauseConfig, renders items above Logout, resolves/public/...icons withChainlitContext, and uses real anchors for proper new-tab behavior.@chainlit/react-clientconfig types to includeuser_menu_links.Written for commit 0b6cc76. Summary will update on new commits.