-
Notifications
You must be signed in to change notification settings - Fork 839
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
[EuiButtonGroup] Add support for EuiToolTip
for button tooltips
#7461
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e1139c0
Update EuiButtonGroup to use EuiTooltip instead of the default browse…
davismcphee d935cfb
Update button group snapshots
davismcphee 2a9d44a
Update unit tests and snapshots
davismcphee d5d6e96
Add unit tests for button group tooltips
davismcphee 12f4a69
Document new prop defaults and add changelog entry
davismcphee 71a2f05
Update React 16 and 17 snapshots
davismcphee 5336e36
Switch from title, titleDelay, and titlePosition props to toolTipCont…
davismcphee a1a5835
Revert changes to column_sorting tests
davismcphee fabad0c
Update changelog entry
davismcphee 2a3872d
Add button group tooltip examples
davismcphee 6106f82
Merge branch 'main' into button-group-tooltips
cee-chen 5be0af3
Misc cleanup
cee-chen 3b3761d
Clean up rendered DOM & CSS approach
cee-chen d2e41ea
Revert opinionated default `title` unset on buttons with tooltips
cee-chen 00d204a
Remove inaccessible/opinionated blur on click
cee-chen d1c076a
More copy tweaks
cee-chen 8598331
Revert custom tooltip click UX storybook example
cee-chen 24ee14b
[design feedback] Regular tooltip delay
cee-chen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Added the following properties to `EuiButtonGroup`'s `options` configs: `toolTipContent`, `toolTipProps`, and `title`. These new properties allow wrapping buttons in `EuiToolTips`, and additionally customizing or disabling the native browser `title` tooltip. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { EuiButtonGroup } from '../../../../src/components'; | ||
|
||
export default () => { | ||
const toggleButtons = [ | ||
{ | ||
id: 'buttonGroup__0', | ||
label: 'Default title', | ||
}, | ||
{ | ||
id: 'buttonGroup__1', | ||
label: 'Custom tooltip content', | ||
toolTipContent: 'This is a custom tooltip', | ||
}, | ||
{ | ||
id: 'buttonGroup__2', | ||
label: 'Custom tooltip props', | ||
toolTipContent: 'This is another custom tooltip', | ||
toolTipProps: { | ||
title: 'My custom title', | ||
delay: 'regular', | ||
position: 'right', | ||
}, | ||
}, | ||
]; | ||
|
||
const [toggleIdSelected, setToggleIdSelected] = useState('buttonGroup__1'); | ||
|
||
const onChange = (optionId) => { | ||
setToggleIdSelected(optionId); | ||
}; | ||
|
||
return ( | ||
<EuiButtonGroup | ||
legend="This is a group with tooltips" | ||
options={toggleButtons} | ||
idSelected={toggleIdSelected} | ||
onChange={(id) => onChange(id)} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 switched from using
index
tooption.id
for thekey
since usingindex
would cause the wrong tooltips to be displayed when modifying theoptions
array of an existing button group (something we do in Discover).