Skip to content

✨ Add navbar_end part in navbar UI#802

Merged
choldgraf merged 5 commits intojupyter-book:mainfrom
choldgraf:enh/navbar-parts
Mar 26, 2026
Merged

✨ Add navbar_end part in navbar UI#802
choldgraf merged 5 commits intojupyter-book:mainfrom
choldgraf:enh/navbar-parts

Conversation

@choldgraf
Copy link
Copy Markdown
Contributor

This adds support for a markdown "part" that is added to the end of the navbar. See the docs for an example of this in action with two {button} roles. If we merge #752 we could replace those with icon links!

  • Adds a new navbar_end site part, following the same pattern as footer, banner, and primary_sidebar_footer.
  • On narrow screens, the content moves into the sidebar menu just above the "horizontal line"
  • On wide screens, it's on the far end of the navbar, after the theme button.
  • I did a little normalizing for spacing between right-side navbar elements (some were padding on both sides, and I made them all pad on one side so it's consistent)
  • I added docs noting that site-level parts parsing isn't supported in the article theme.

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 11, 2026

Deploy Preview for myst-theme ready!

Name Link
🔨 Latest commit 53c3144
🔍 Latest deploy log https://app.netlify.com/projects/myst-theme/deploys/69ba4b40861e8400080c96e5
😎 Deploy Preview https://deploy-preview-802--myst-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 11, 2026

🦋 Changeset detected

Latest commit: 53c3144

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@myst-theme/site Patch
@myst-theme/book Patch
@myst-theme/providers Patch
@myst-theme/frontmatter Patch
@myst-theme/diagrams Patch
@myst-theme/jupyter Patch
@myst-theme/styles Patch
@myst-theme/common Patch
@myst-theme/icons Patch
@myst-theme/search Patch
@myst-theme/search-minisearch Patch
@myst-theme/landing-pages Patch
@myst-theme/anywidget Patch
@myst-theme/article Patch
myst-to-react Patch
myst-demo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@choldgraf choldgraf added the enhancement New feature or request label Feb 13, 2026
<ThemeButton className="w-10 h-10 ml-3" />
{/* Custom part at end of navbar */}
{navbarEnd && (
<div className="article myst-navbar-end hidden xl:flex items-center ml-3 [&>*]:m-0">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why hidden ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's hidden because we have to render the navbar items in two places:

  • Once in the navbar for wide screens
  • Once in the sidebar drawer for narrow/mobile screens

So here we hide it until we hit xl width, at which point it becomes flex

Copy link
Copy Markdown
Collaborator

@stefanv stefanv left a comment

Choose a reason for hiding this comment

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

Same question as @parmentelat about hidden and xl:hidden, otherwise LGTM, and a neat addition!

{navbarEnd && (
<div
className={classNames(
'article myst-primary-sidebar-navbar-end xl:hidden p-2 my-1 flex flex-wrap gap-2 [&_p]:contents',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here we show the navbar items up until we hit xl at which point it becomes hidden

Removed patch version for '@myst-theme/docs' and added navbar_end part in navbar UI.
@choldgraf
Copy link
Copy Markdown
Contributor Author

Question answered! does that make sense to y'all?

Comment thread packages/site/src/components/Navigation/TopNav.tsx Outdated
hide_toc?: boolean;
mobileOnly?: boolean;
footer?: React.ReactNode;
navbarEnd?: GenericParent;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

GenericParent feels so... generic :)

Copy link
Copy Markdown
Contributor Author

@choldgraf choldgraf Mar 23, 2026

Choose a reason for hiding this comment

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

I can't tell if this is a suggestion to do something different or not - but it's a good point that footer already uses ReactNode....I can try to make this follow the same pattern and see if I can get the outcome we want. Is that what you'd like me to do?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry, I was musing to myself that the typing feels less than optimal here. But this requires a systematic review to address, nothing for you to take care of here!

@choldgraf
Copy link
Copy Markdown
Contributor Author

I asked in the chat and Stefan said his comment was non-blocking, so I'm gonna merge this since we have an approve so we can close this out, thanks for the review folks :-)

@choldgraf choldgraf merged commit ee2d127 into jupyter-book:main Mar 26, 2026
3 checks passed
@rowanc1
Copy link
Copy Markdown
Member

rowanc1 commented Mar 26, 2026

Amazing. Nice work! 🚀

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend the navbar via parts configuration (similar to the sidebar and footer)

4 participants