Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][docs][Tooltip] Add demo to show how to change distance between tooltip and its anchor #40087

Conversation

anle9650
Copy link
Contributor

@anle9650 anle9650 commented Dec 3, 2023

@mui-bot
Copy link

mui-bot commented Dec 3, 2023

Netlify deploy preview

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against bf5a08c

@anle9650 anle9650 marked this pull request as ready for review December 3, 2023 05:21
@danilo-leal danilo-leal added docs Improvements or additions to the documentation component: tooltip This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Dec 4, 2023
@samuelsycamore
Copy link
Member

Thanks for this @anle9650 ! Please run yarn docs:typescript:formatted to get that last CI check to pass.

@anle9650
Copy link
Contributor Author

Thanks for this @anle9650 ! Please run yarn docs:typescript:formatted to get that last CI check to pass.

Hey @samuelsycamore running yarn docs:typescript:formatted removes TooltipMargin.tsx.preview & TooltipOffset.tsx.preview from the PR, which show the code preview below the demos. Any ideas on how I can get around this?

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Hey @samuelsycamore running yarn docs:typescript:formatted removes TooltipMargin.tsx.preview & TooltipOffset.tsx.preview from the PR, which show the code preview below the demos. Any ideas on how I can get around this?

It's excluded because the returned JSX is over 16 lines. Previews are generated only for code within that limit. Omitting the code preview seems acceptable here.

docs/data/material/components/tooltips/TooltipMargin.tsx Outdated Show resolved Hide resolved
docs/data/material/components/tooltips/TooltipMargin.tsx Outdated Show resolved Hide resolved
docs/data/material/components/tooltips/TooltipMargin.tsx Outdated Show resolved Hide resolved
docs/data/material/components/tooltips/TooltipOffset.tsx Outdated Show resolved Hide resolved
anle9650 and others added 7 commits December 23, 2023 15:22
Co-authored-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
Signed-off-by: Andy Le <andy.le@ucdenver.edu>
Co-authored-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
Signed-off-by: Andy Le <andy.le@ucdenver.edu>
Co-authored-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
Signed-off-by: Andy Le <andy.le@ucdenver.edu>
Co-authored-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
Signed-off-by: Andy Le <andy.le@ucdenver.edu>
@anle9650
Copy link
Contributor Author

It's excluded because the returned JSX is over 16 lines. Previews are generated only for code within that limit. Omitting the code preview seems acceptable here.

@ZeeshanTamboli thanks for the heads up! I went ahead and removed those.

@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui][docs][Tooltip] demo how to change distance between tooltip and its anchor [material-ui][docs][Tooltip] Add demo to show how to change distance between tooltip and its anchor Dec 25, 2023
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

@anle9650 The tooltip margin customization wasn't working as expected. I had to target by increasing the CSS specificity with the following adjustment:

[`&.${tooltipClasses.popper}[data-popper-placement*="bottom"] .${tooltipClasses.tooltip}`]: {
  marginTop: '0px';
}

I also changed the margin from 20px to 0px because it seems that having less distance between the tooltip and the anchor is the most requested use case in #19848.

It looks good now. Thanks for your contribution!

@ZeeshanTamboli ZeeshanTamboli merged commit c722f50 into mui:master Dec 25, 2023
19 checks passed
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Jan 9, 2024
…between tooltip and its anchor (mui#40087)

Signed-off-by: Andy Le <andy.le@ucdenver.edu>
Co-authored-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tooltip This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation package: material-ui Specific to @mui/material
Projects
None yet
5 participants