-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update EuiComboBox tooltip docs example
- Loading branch information
Showing
2 changed files
with
43 additions
and
99 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { | ||
EuiComboBox, | ||
EuiComboBoxOptionOption, | ||
} from '../../../../src/components'; | ||
|
||
const options: Array<EuiComboBoxOptionOption<string>> = [ | ||
{ | ||
label: 'Titan', | ||
toolTipContent: | ||
'Titan is the largest moon of Saturn and the second-largest in the Solar System', | ||
}, | ||
{ | ||
label: 'Pandora', | ||
toolTipContent: | ||
"Pandora is one of Saturn's moons, named for a Titaness of Greek mythology", | ||
}, | ||
{ | ||
label: 'Iapetus', | ||
toolTipContent: "Iapetus is the outermost of Saturn's large moons", | ||
toolTipProps: { position: 'bottom' }, | ||
}, | ||
]; | ||
export default () => { | ||
const [selectedOptions, setSelected] = useState([options[2]]); | ||
|
||
const onChange = ( | ||
selectedOptions: Array<EuiComboBoxOptionOption<string>> | ||
) => { | ||
setSelected(selectedOptions); | ||
}; | ||
|
||
return ( | ||
<EuiComboBox | ||
aria-label="Example of combobox options with tooltips" | ||
options={options} | ||
selectedOptions={selectedOptions} | ||
onChange={onChange} | ||
isClearable={true} | ||
/> | ||
); | ||
}; |