Skip to content

Conversation

@mj12albert
Copy link
Member

@mj12albert mj12albert commented Jun 18, 2025

Preview: https://deploy-preview-2135--base-ui.netlify.app/react/components/toggle

Uses native <details>+<summary> for the new props table design; also applies to CSS vars and data attrs tables where the popover is replaced with a <details>.

Notable differences from Accordion:

  • VO reads the trigger as "disclosure triangle, group" in Chrome, "summary, group" in Firefox and Safari; overall it's a bit shorter because it doesn't have a heading element adding to the announcement
    Screenshot 2025-06-18 at 11 25 40 PM
  • Can't arrow between triggers like Accordion but is lightly reimplemented here
  • It's hidden="until-found" by default when supported, no need to fight React 👍

Closes #1752

@mj12albert mj12albert added the docs Improvements or additions to the documentation. label Jun 18, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 18, 2025

vite-css-base-ui-example

pnpm add https://pkg.pr.new/mui/base-ui/@base-ui-components/react@2135
pnpm add https://pkg.pr.new/mui/base-ui/@base-ui-components/utils@2135

commit: 5457b8c

@mui-bot
Copy link

mui-bot commented Jun 18, 2025

Bundle size report

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

Details of bundle changes

Generated by 🚫 dangerJS against 5457b8c

@netlify
Copy link

netlify bot commented Jun 18, 2025

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 5457b8c
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6886cdb8da51550008644f3d
😎 Deploy Preview https://deploy-preview-2135--base-ui.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.

@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch 2 times, most recently from ee2882d to c06723b Compare June 18, 2025 15:30
Comment on lines 106 to 105
if (['boolean', 'string', 'number'].includes(type)) {
return type;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above. The [...].includes(...) syntax is bad for performance

Copy link
Member Author

Choose a reason for hiding this comment

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

For now this is just a throwaway ~
But should we generate the short prop type here or via the api extractor? @michaldudak

Copy link
Member

Choose a reason for hiding this comment

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

If API extractor returns an IntrinsicNode, we should use it as is.

If the returned type has both the name an either types (like a union or intersection) or properties (object type), use the name as a short type and drill into the details for the expanded view.

@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch 4 times, most recently from d40518c to 0f4851e Compare June 24, 2025 18:16
Copy link
Contributor

@romgrk romgrk Jun 24, 2025

Choose a reason for hiding this comment

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

I wonder if we should avoid repeating the default value in the expanded details. It adds noise if we repeat information, and noise is not great for UX.

And I wonder if we shouldn't mark the Type in the expanded details as something like Type (detailed), or inversely mark the column header as Type (simplified), to convey that there's possibly more information in the expanded details.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

if reducing noise is the goal, then I would remove the default from the summary and only have it in the panel.

In the screenshot below, the visual noise is coming from the repetition of the word "default".

Screenshot 2025-07-22 at 07 09 50

So I see 3 options:

  1. Remove the default from the summary, and just have it in the expanded panel. Of course, the trade-off is that you can't see the default at a glance.
  2. Add a new column for default.
  3. Just leave it as-is.

Copy link
Contributor

@romgrk romgrk Jul 22, 2025

Choose a reason for hiding this comment

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

  1. Sounds like a worst UX, there's less information available without clicking. When I refer to a props table, it's nice to be able to keep it open as a reference while I write code and see everything at a glance.
  2. That's the way it was before, and it left less place for the type description, and in some cases it was nearly all empty. Tbh I suggested merging type & default in a single column because I was hoping to have more space to show the type, but now that long function types are always simplified to function and hidden, it's less relevant, but imho hidding the function types isn't necessary.
  3. Doesn't feel too bad. We could also find a terser notation, e.g. name the column Type [Default] and use values like boolean [false]. Or integrate the default to the name column, e.g. defaultChecked = false, but we have a lot of unused space in the type column.
    edit: Or boolean [=false], somewhat similar to jsdoc's [name=default] notation.

Sidenote but there's still default: undefined entries, we should not display the default if there is none or if it's undefined.

<TableCode className="text-navy">{name}</TableCode>
{prop.type && (
<span className="flex items-baseline gap-4 text-sm">
<ShortPropType />
Copy link
Contributor

@romgrk romgrk Jun 24, 2025

Choose a reason for hiding this comment

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

I'm on the fence about hiding the detailed type in the details in some cases. For render & className it makes sense to always hide it, but for other cases (like below) I think it might degrade the UX a bit to have to click to see the full type. I wonder if we could try to hide it based on its length.

image

Copy link
Contributor

@colmtuite colmtuite Jul 22, 2025

Choose a reason for hiding this comment

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

The full type is available in a tooltip

Screenshot 2025-07-22 at 07 19 28

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice for mouse users, but keyboard-centric users (which are probably higher in proportion among devs) don't have that, and requiring a hover is not that far from requiring a click. I still think we should use the space if we have the space.

Copy link
Contributor

Choose a reason for hiding this comment

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

I played a bit with the styling, sharing in case it inspires you to change things a bit. Imho the current box-shadow is too intense.

Before After
Screenshot From 2025-06-24 17-06-05 Screenshot From 2025-06-24 17-06-52

Copy link
Member Author

Choose a reason for hiding this comment

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

CC @colmtuite , this continues from #2120 (comment)

I toned down the shadow, but there's still the issue of the open panel background being very similar to the hover state of the trigger

@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch 2 times, most recently from 015c0ac to b0fdd83 Compare June 27, 2025 17:34
@mj12albert
Copy link
Member Author

Needs #2104 to generate the json in the new format

@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch 5 times, most recently from bd4384c to b20172b Compare July 3, 2025 09:04
@atomiks
Copy link
Contributor

atomiks commented Jul 3, 2025

Seems like it shouldn't open while trying to select text. (The Accordion example made this impossible, but that's not accessible)

Screen.Recording.2025-07-03.at.7.06.44.pm.mov

@mj12albert mj12albert changed the title [docs] Native details-summary props table [docs] New props table Jul 7, 2025
@mj12albert
Copy link
Member Author

Seems like it shouldn't open while trying to select text

When clicking the text selection, should it cancel the text selection only or toggle the element as well?

Screen.Recording.2025-07-07.at.4.47.18.PM.mov

Or should we use user-select:none for consistency, in the docs we seem to do this for all interactive elements

@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch from 66b69cf to 8433206 Compare July 7, 2025 08:54
@atomiks
Copy link
Contributor

atomiks commented Jul 7, 2025

The main issue with disabling text selection is that you can't copy the name of the prop when trying to select it. Double clicking also allows the entire text to be selected. Maybe trying to click on text shouldn't open it, but everywhere else is fine

@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch from 8433206 to 07d4cde Compare July 7, 2025 17:44
@mj12albert mj12albert force-pushed the docs/disclosure-props-table branch from 69c9a8f to af8e1dc Compare July 21, 2025 04:36
@colmtuite
Copy link
Contributor

colmtuite commented Jul 22, 2025

@mj12albert I mentioned setting scroll-margin-top to 0 on the meeting, but didn't understand the reasoning or outcome. Isn't this better?

Screen.Recording.2025-07-22.at.07.25.47.mov

@mj12albert
Copy link
Member Author

@mj12albert I mentioned setting scroll-margin-top to 0 on the meeting, but didn't understand the reasoning or outcome. Isn't this better?

I updated it to 0, what about in the mobile layout do you want the scroll margin to make the trigger flush against the header? @colmtuite

Screenshot 2025-07-22 at 10 42 01 PM

@colmtuite
Copy link
Contributor

@mj12albert yea, looks nice 👌

@mj12albert
Copy link
Member Author

mj12albert commented Jul 23, 2025

For aligning the mobile layout of the various tables, the triggers all use display: flex by default (the base Accordion styles) unless there's 3 or more "cells" then it'll change to grid

Also added the overscroll graphic to the trigger as it could overflow in some cases:

scrollable.mov

Any further feedback or is it good to go? @colmtuite

@atomiks atomiks merged commit d2e2a85 into mui:master Jul 28, 2025
19 of 20 checks passed
atomiks pushed a commit to atomiks/base-ui that referenced this pull request Aug 1, 2025
@mj12albert mj12albert deleted the docs/disclosure-props-table branch August 4, 2025 03:51
atomiks pushed a commit to atomiks/base-ui that referenced this pull request Sep 10, 2025
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.

[docs] Fix API table design

6 participants