material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

Tooltip's Arrow Position

Open muticansel opened this issue 2 years ago • 6 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Summary 💡

I want to position the tooltip's arrow just like the tooltip 'placement' prop. For example, when I use "bottom-start" and if the children of the tooltip are long, the arrow is positioned to the right, but I want to position it on the left. Am I missing that feature or is there no option for that?

image

There is an issue for that https://github.com/mui/material-ui/issues/37651 But the solution is not reusable. I do not know always my tooltip's width. (according to the language and for some different usage on different pages)

Examples 🌈

No response

Motivation 🔦

No response

muticansel avatar Jul 17 '23 11:07 muticansel

Please share a minimal reproducible demo for what you are describing.

brijeshb42 avatar Jul 17 '23 12:07 brijeshb42

https://stackblitz.com/edit/react-qqwxar-wsryis?file=demo.tsx

This is a sample. Arrow is on the middle but I want it to position on the left side of the tooltip

muticansel avatar Jul 17 '23 13:07 muticansel

@muticansel I have created an Issue #38012 , check Is your same to this or not.

OmPr366 avatar Jul 17 '23 14:07 OmPr366

Hi @OmPr366,

Thanks for your reply but it is similar, not the same. You mentioned that "bottom-start" and "bottom-end" has same behavior but I just want to position the arrow according to the cases. For example, think you gave "bottom-end" but I want to position the arrow on the right-most side of the tooltip or for some cases on the left-most side and etc.

muticansel avatar Jul 17 '23 14:07 muticansel

There doesAdding this to the <Tooltip> element moves the arrow to the right end but similar change for left doesn't seem to work,

PopperProps={{
  popperOptions: {
    modifiers: [
      {
        name: "arrow",
        enabled: true,
        options: {
          padding: ({ popper }) => {
            return popper.width - 15;
          },
        },
      },
    ],
  },
}}

I don't think this is supported in popperjs itself but I'll have to confirm.

brijeshb42 avatar Jul 17 '23 18:07 brijeshb42

+1 for this

mparsakia avatar Jul 22 '24 17:07 mparsakia