-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(tooltip): Add off
prop
#539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👌
|
||
There may be cases when you only want to enable the display of a tooltip under a certain condition. In these cases, you may want to set the `isEnabled` prop to false. | ||
|
||
In the following example, the tooltip text only appears on hover when the button is disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading this I like this more than isVisible
cause the latter may spark the understanding that it is forced to be visible even without hovering. Maybe isSurpressed
is another name for the prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emmenko do you have any opinions on the prop naming?
- isDisabled
- isEnabled
- isSurpressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I liked isSurpressed but am leaning towards isDisabled for API consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, if you end up doing isEnabled={!props.isDisabled}
maybe isDisabled
makes more sense?
I'm also thinking about something like off
, which maybe better indicates that the event listeners are turned off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it to isDisabled
. The other option could be isOff 🤔.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just off
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of our other props start with is
though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with off
if @tdeekens is as well. I just want to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
off
is fine. I kind of don't like to break with patterns unless there is a good reason. So my choice would have been isOff
even if that is more to write.
isEnabled
propisDisabled
prop
isDisabled
propoff
prop
Summary
Adds the prop
isEnabled
to the tooltip. It sort of mirrors the old "display" prop from the core tooltip.Motivation
While refactoring the MC and adding the new tooltip, I found a lot of cases when I had to make code like this
This prop should make it a bit cleaner.