Skip to content

[docs] Wide docs layout#47950

Merged
noraleonte merged 12 commits intomui:masterfrom
noraleonte:wide-docs
Mar 18, 2026
Merged

[docs] Wide docs layout#47950
noraleonte merged 12 commits intomui:masterfrom
noraleonte:wide-docs

Conversation

@noraleonte
Copy link
Copy Markdown
Contributor

@noraleonte noraleonte commented Mar 11, 2026

Preview

In this PR

  • Moved the Diamond sponsors to the left . This makes them independent from the ToC, which means that if the ToC is minified or hidden for smaller devices, the diamond sponsors remain visible.
  • Added two props to <MarkdownDocs />:
    • wideLayout: increases the maximum width of the docs content to xl/1536px.
    • collapseToc: replaces the current ToC with a minified version on ALL breakpoints where it is visible (ToC is hidden on tablet and mobile)
Recording.2026-03-11.170933.mp4

The two props are independent, so technically the current ToC can be used with the wide docs or we can use the minified ToC with the narrow docs.

image

Open question

Do we want to change the current default behavior and enforce the minified ToC on smaller devices (at least lg and md)? Right now we hide the ToC under 1440px which might not be a great UX 🤔

@noraleonte noraleonte self-assigned this Mar 11, 2026
@noraleonte noraleonte added docs Improvements or additions to the documentation. design This is about UI or UX design, please involve a designer. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Mar 11, 2026
@mui-bot
Copy link
Copy Markdown

mui-bot commented Mar 11, 2026

Netlify deploy preview

https://deploy-preview-47950--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against b24240d

@mnajdova
Copy link
Copy Markdown
Member

It looks very nice 👌 Some issues I spotted:

  • There is some z-index issue
Screenshot 2026-03-11 at 16 34 45 Screenshot 2026-03-11 at 16 38 15

const {
disableAd = false,
disableToc = false,
container,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
container,
container = 'narrow',

?

const {
disableAd = false,
disableToc = false,
container,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
container,
container = 'narrow',

Same?

title: PropTypes.string,
}),
children: PropTypes.node.isRequired,
container: PropTypes.oneOf(['narrow', 'wide']),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would recommend using a boolean prop if there are only two options.

@dav-is
Copy link
Copy Markdown
Member

dav-is commented Mar 12, 2026

It looks perfect on my veritcal screen 😄 it's a nice touch

Screenshot From 2026-03-11 20-45-21

Nice to see it also works without JS and progressively enhances with the popover.


It looks like the feedback butons aren't full width here:

Screenshot From 2026-03-11 20-46-07

Also it seems that the entire table of contents container has cursor: click instead of just the buttons.

I'm not sure if it makes sense, but the tabindex of the table of contents comes after the content.

@noraleonte
Copy link
Copy Markdown
Contributor Author

@mnajdova @dav-is Thank you for the review 🙏

  • fixed z-index issue
  • container: 'wide' | 'narrow' -> wideLayout: boolean
  • In the popper only the buttons have cursor:pointer
  • Reworked the diamond sponsors a bit to not look stratched: I kept the spacing for consistence, but places the two sponsors side by side. LMK what you think. If it still feels off we can go with changing the spacing
image
  • The default behavior of the ToC is different now: before, we were hiding the ToC entirely below xl -> Now, even if collapseToc is false, on lg we show the MiniToc instead off hiding the ToC entirely. Basically as long as we have a navigation, we have some variant of the ToC visible at all times. The ToC is hidden only on tablet and mobile now.

@noraleonte noraleonte requested a review from mnajdova March 12, 2026 13:49
@dav-is
Copy link
Copy Markdown
Member

dav-is commented Mar 12, 2026

Maybe we need to also show the popover on focus and change the selected item when focus changes?

Screencast.From.2026-03-12.09-53-57.webm

@dav-is
Copy link
Copy Markdown
Member

dav-is commented Mar 12, 2026

Are we able to add the collapsed ToC when on other pages when the width is too small for the full ToC? I like having it on my veritcal desktop screen

@noraleonte
Copy link
Copy Markdown
Contributor Author

Really good catch 🙏 Thanks
Popover now opens on focus and highlighting is working as well
MiniToC is being displayed above 900px always 😄
image

Copy link
Copy Markdown
Member

@aarongarciah aarongarciah left a comment

Choose a reason for hiding this comment

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

Looking good!

  • I think it'd make sense to collapse the ToC only when there's not enough space. See this screenshot for example. Why hide it when there's room to display it?
    Image

  • The collapsed ToC accessibility is broken. The links have no label. When using a screen reader, there should be no difference between the collapsed and uncollapsed versions. See screenshots below.

    The ToC popover can be treated as visual aid for sighted users (same mental model as Base UI Tooltips), so I think we could just hide it from assistive tech if the collapsed version labels are fixed.

    Regular ToC
    Image

    Collapsed ToC
    Image

@noraleonte
Copy link
Copy Markdown
Contributor Author

Thanks for the review, Aaron 🙏

I think it'd make sense to collapse the ToC only when there's not enough space

Hmm, that could also make sense 🤔 In that case, DX question - would you
a. remove the collapseToc prop entirely and adjust the default behavior
b. change collapseToc: boolean to collapseBelow: 'ld' | 'xl' | '2xl'?

@aarongarciah
Copy link
Copy Markdown
Member

aarongarciah commented Mar 13, 2026

Hmm, that could also make sense 🤔 In that case, DX question - would you
a. remove the collapseToc prop entirely and adjust the default behavior
b. change collapseToc: boolean to collapseBelow: 'ld' | 'xl' | '2xl'?

For context: we chatted about it and we decided to try option a

@mnajdova
Copy link
Copy Markdown
Member

mnajdova commented Mar 13, 2026

How will the sponsors UI look when we have third sponsor?

@noraleonte
Copy link
Copy Markdown
Contributor Author

Update:

  • removed collapseToc prop entirely
  • adjusted default behavior to only render MiniToc when there isn't space for the full width one

@mnajdova an idea of what I was thinking off when I changed the sponsors layout:

image

@Janpot
Copy link
Copy Markdown
Member

Janpot commented Mar 17, 2026

2 remarks:

  1. I noticed the lengths of the bars follow the lengths of the strings. Would it make sense to also replicate the indentation as well, on the right side? I wonder if it would improve scannability.
  2. hovering over one of the bars syncs with hover effect on the items in the tooltip, but not vice versa. Shouldn't hovering the text items also sync with the hover effect on the condensed view?

@noraleonte
Copy link
Copy Markdown
Contributor Author

Thanks, Jan 🙏

  1. Not sure it would for two reasons:

    • The bars are pretty small so I don't think it would be visible
    • They are aligned to the right wo even with indentation, they would probably look like very small bars.
      So I'm not sure it would add value 🤔
  2. Syncing the hover of the bars with the titles felt useful because otherwise, you have no way of knowing to which section each bar would take you on click. I wasn't sure there is value in syncing the hover of the titles with the bars, since the result is expected 🤔 But it also doesn't hurt consistency so I made the change 👌

@noraleonte noraleonte merged commit ec3a25b into mui:master Mar 18, 2026
19 checks passed
@oliviertassinari
Copy link
Copy Markdown
Member

oliviertassinari commented Mar 25, 2026

Moved the Diamond sponsors to the left

We want to support an infinite number of sponsors, but this is not going to support it. I'm also not sure about the reduced vertical space for scrolling the side nav on a 14" screen.

So how about?

  1. We restore the previous ad placement, but simply do not show any of this when the docs mode is large. Tailwind CSS makes it work, $2M/year of donation without showing the sponsors in the docs.
  2. We don't use the wide layout unless the component is really big, so only the scheduler today. For example, on a table page, this feels worse, It's too wide; people have to scan and read a lot more length.
  3. We add this mode to the docs of docs-infra, meaning: https://deploy-preview-48091--material-ui.netlify.app/experiments/docs/callouts/ cc @dav-is for awareness.

Side feedback:

Are the lengths of the bars optimal?

SCR-20260325-ogns

I thought the length of a bar was supposed to encode the hx nature of them. At least, that's how Notion helps me skip h3 when I want to move to the next h2.

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

Labels

design This is about UI or UX design, please involve a designer. docs Improvements or additions to the documentation. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants