Open julianCast opened 1 year ago
success
state mainly depends on the context of the app. It could mean that if there is no error
either when all the validation has passed. You could still use the color
prop directly to style your success state when there is no error in your input.
success
state mainly depends on the context of the app. It could mean that if there is noerror
either when all the validation has passed. You could still use thecolor
prop directly to style you success state when there is no error in your input.
It's true, but if inputs would allow to receive a prop like success
, we would still be able to manage it while MUI applies the proper palette. I understand the paradigm of having two boolean
could lead to a wrong use, but again that would rely on the developer.
No sucess and no error => Stand by (as it is now when boolean error
is false
).
--
Another approach if success
is too opinionated, would be colorPrimary
as a property of OutlinedInputClasses
so we could do :
[`&.${outlinedInputClasses.colorPrimary}`]: {
border: "1px solid blue"
}
Anyway, this is more a suggestion than an issue, so take it like that. Thanks!
If I want to get the MUI class of a success input element I have to code it via props in the logic, but I'd like to know if there is a similar way when, for example, we get the
error
class, or thecolorSecondary
. https://github.com/mui/material-ui/blob/a33eb7cba66a5c5631ba77c96d2fafaa12ed9f32/packages/mui-material/src/OutlinedInput/outlinedInputClasses.ts#L5-L9 We havecolorSecondary
or evenerror
here https://github.com/mui/material-ui/blob/0d3aba1c9433dc5dd79dd9af6821c25b48d6f4f7/packages/mui-material-next/src/Input/inputClasses.ts#L14 I wonder why we don't have acolorPrimary
orsuccess
Example of use
For example, in a theme, we can custom set a color if the input has error state as follow:
But we can't set it if the input has success state because there is no
outlinedInputClasses.success
oroutlinedInputClasses.colorPrimary