Skip to content
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

[EuiSelect] allow select's value to be reset with an undefined value #4428

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added a `size` prop to `EuiContextMenu` and added a smaller size ([#4409](https://github.com/elastic/eui/pull/4409))
- Allowed visual state of `EuiSelect` with `hasNoInitialSelection` to be reset with `value={undefined}` ([#4428](https://github.com/elastic/eui/pull/4428))
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved

## [`31.2.0`](https://github.com/elastic/eui/tree/v31.2.0)

Expand Down
7 changes: 6 additions & 1 deletion src-docs/src/views/form_controls/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ export default () => {
{ value: 'option_three', text: 'Option three' },
];

const [value, setValue] = useState(options[1].value);
const [value, setValue] = useState(undefined);

const onChange = (e) => {
setValue(e.target.value);
};

window.asdf = () => {
setValue(undefined);
}
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved

return (
/* DisplayToggles wrapper for Docs only */
<DisplayToggles canPrepend canAppend canReadOnly={false}>
<EuiSelect
hasNoInitialSelection
chandlerprall marked this conversation as resolved.
Show resolved Hide resolved
id="selectDocExample"
options={options}
value={value}
Expand Down