Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

mdTooltip - allow tooltip to be positioned top/bottom/left/right #1220

Closed
cmjacques opened this issue Jan 18, 2015 · 5 comments
Closed

mdTooltip - allow tooltip to be positioned top/bottom/left/right #1220

cmjacques opened this issue Jan 18, 2015 · 5 comments
Assignees
Milestone

Comments

@cmjacques
Copy link

I noticed that this functionality was considered in issue 354.

Looking at the spec it seems that tooltips are not limited to opening from top or bottom.

Being able to position tooltips left and right (as long as there is enough space) would come in very handy in my latest project.

Thanks and keep up the good work.

@mzbyszynski
Copy link
Contributor

👍

One example of this are the fab buttons fixed to the lower right portion of the screen in Google Inbox. They each have tooltips that float to the left of each button.

@epelc
Copy link
Contributor

epelc commented Jan 19, 2015

+1 Would be nice to override the default behavior but can it still be smart and move itself if its near the edge of your screen.

@cmjacques
Copy link
Author

I'm very new to git (and AngularJS), but I managed to fork the code and make the following changes -

  • Tooltips can now be opened 'top', 'bottom', 'left' or 'right' by setting the md-direction attribute. The default direction is 'bottom'.
  • If the requested direction would cause the tooltip to open outside the viewport (or too close to the edge) then it will open in the opposite direction.

I'm not quite game to create a pull request (just yet), but you can check out my changes here.

@naomiblack naomiblack modified the milestones: 0.7.1, 0.8.0 Jan 26, 2015
@ajoslin ajoslin added the in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs label Feb 6, 2015
@ajoslin ajoslin removed in progress Mainly for in progress PRs, but may be used for issues that require multiple PRs resolution: fixed labels Feb 10, 2015
@ejbaker
Copy link

ejbaker commented Feb 15, 2016

Would it be possible to do md-direction "top right", "top center", "top left"...? The default of having it always be centered is really throwing off some lengthy objects I want to add a tooltip to.

@Splaktar
Copy link
Member

@ejbaker that would be a good question for the ngMaterial forums, but not for a closed issue. You could link this issue to your forum post though. A CodePen demo would also be helpful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants