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
[Select] Null value not working #23558
Comments
@radzk the value can't be diff --git a/packages/material-ui/src/Select/Select.d.ts b/packages/material-ui/src/Select/Select.d.ts
index 36819277b5..16db364bf3 100644
--- a/packages/material-ui/src/Select/Select.d.ts
+++ b/packages/material-ui/src/Select/Select.d.ts
@@ -149,7 +149,6 @@ export interface SelectProps<T = unknown>
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
/**
* The `input` value. Providing an empty string will select no options.
- * This prop is required when the `native` prop is `false` (default).
* Set to an empty string `''` if you don't want any of the available options to be selected.
*
* If the value is an object it must have reference equality with the option in order to be selected. |
@oliviertassinari I'm not sure about this removed line, I don't think it has anything to do with my problem. I'm referring more to the next line: "Set to an empty string Anyway I found a workaround for my case for now, just switching null to 'all' and vice-versa, like below..
|
[Feature request] Would it be possible to redesign the component to allow null value for the option? |
https://material-ui.com/api/select/
The docs says that you cannot use empty string value for value field. As long as this is eventually acceptable, there is an issue, because for some reason null value also does not work. These both totally break my communication with backend service, because it seems I'll have to find and replace the values before saving (I do want to save null).
If I change the nulls to any non-empty string, it works, but it isnt a solution.
const options = [{ name: 'Default', value: null }, { name: 'Alternative', value: 'alternative' }]; const currentValue = null;
The text was updated successfully, but these errors were encountered: