Skip to content

[docs] Demo chrome tweaks#4983

Open
aarongarciah wants to merge 15 commits into
mui:masterfrom
aarongarciah:docs-demos-collapsed
Open

[docs] Demo chrome tweaks#4983
aarongarciah wants to merge 15 commits into
mui:masterfrom
aarongarciah:docs-demos-collapsed

Conversation

@aarongarciah

@aarongarciah aarongarciah commented Jun 8, 2026

Copy link
Copy Markdown
Member

Preview: https://deploy-preview-4983--base-ui.netlify.app/react/overview/quick-start

  • Demos
    • Removes compact demos.
    • Reduces the height of the code block when collapsed, so only 4 lines are displayed.
    • The whole code block is clickable to expand the demo code block when collapsed.
    • New tabs style.
    • New "Show code" button styles.
    • Removes the "Hide code" button once it's expanded.
    • Moves the copy code button from the demo toolbar to the demo code block.
    • Hides file tabs when there's only one file (that's the case for most Tailwind demos).
  • Updated installation block (present in quick start page) styles so tabs have the same vibe as demo tabs.
  • Removes the "Copy" visual label from regular code blocks.
  • Updates regular code blocks, prop tables, etc., to match the demos' border radius.
before after
Screenshot 2026-06-08 at 18 34 54 Screenshot 2026-06-08 at 18 35 37
Screenshot 2026-06-08 at 18 35 52 image

@aarongarciah aarongarciah added the docs Improvements or additions to the documentation. label Jun 8, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

commit: 3de0642

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 8, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

Total duration: 1,192.00 ms -125.55 ms(-9.5%) | Renders: 50 (+0) | Paint: 1,813.65 ms -194.16 ms(-9.7%)

Test Duration Renders
Slider mount (300 instances) 160.55 ms ▼-61.85 ms(-27.8%) 3 (+0)
Checkbox mount (500 instances) 65.01 ms ▼-27.14 ms(-29.4%) 1 (+0)
Tooltip mount (300 contained roots) 47.40 ms ▼-14.25 ms(-23.1%) 1 (+0)

9 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 3de0642
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a26ef0f36af50000935a72b
😎 Deploy Preview https://deploy-preview-4983--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@aarongarciah aarongarciah force-pushed the docs-demos-collapsed branch from 15d768a to d0963f7 Compare June 8, 2026 15:51
@aarongarciah aarongarciah requested a review from colmtuite June 8, 2026 16:20
@aarongarciah aarongarciah changed the title [docs] Demo chrome tweaks [docs] Demos tweaks Jun 8, 2026
@aarongarciah aarongarciah marked this pull request as ready for review June 8, 2026 16:22
@aarongarciah aarongarciah changed the title [docs] Demos tweaks [docs] Demo chrome tweaks Jun 8, 2026
@atomiks

atomiks commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Reduces the height of the code block when collapsed, so only 4 lines are displayed.

I'd match the non-collapsed line count (on Button it seems to be 7). It feels slightly off to only show imports instead of the export default function ExampleComponent() {... line in the collapsed state and for non-collapsed/collapsed heights to be different.

@aarongarciah

aarongarciah commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

I'd match the non-collapsed line count (on Button it seems to be 7)

Not sure about that. I think 7 lines for the collapsed version might be too much. Do you see a clear benefit?

It feels slightly off to only show imports instead of the export default function ExampleComponent() {... line

I wanted to explore that in a follow-up PR, and use the ESLint rule from code-infra to lint // @focus-start and // @focus-end comments if we want to focus the main function on each demo. To be honest, I don't know how helpful it is to focus export default function ExampleComponent() { instead of just the begining of the file, because when the user expands the code block, the line the user was looking at will be elsewhere (unless we do some scroll magic). For example:

collapsed expanded
Screenshot 2026-06-09 at 00 09 02 Screenshot 2026-06-08 at 23 48 00

for non-collapsed/collapsed heights to be different.

Not sure what you mean by "non-collapsed/collapsed heights to be different". Non-collapsed demo code blocks just display the whole thing. Right now, only demos with less than 12 lines are non-collapsed automatically.

@atomiks

atomiks commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Not sure about that. I think 7 lines for the collapsed version might be too much. Do you see a clear benefit?

Maybe I'm over-indexing on consistency with non-collapsible blocks. 4 vs 7 lines is 96px vs 156px from what I see (with Button), which doesn't doesn't feel too much extra? But if you said 12 lines is the limit, then some non-collapsible blocks would be inconsistent anyway, I guess...

It's just that, 4 just looks weirdly short to the point where it seems somewhat pointless to even show a partially expanded state, while 7 is somewhat justified given it shows the top of the component function.

Not sure what you mean by "non-collapsed/collapsed heights to be different".

Yeah I meant non-collapsed as in non-collapsible here, code blocks short enough that they don't collapse at all

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

Labels

docs Improvements or additions to the documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants