I am using the material-ui react textField with type time , I want to remove the arrow and cross that appears on the right on hover and focus.
https://github.com/mui-org/material-ui/blob/master/docs/src/pages/demos/pickers/DatePickers.js
The easiest way to remove the border from a Material-UI TextField is to use the 'standard' variant instead of the default 'outlined' variant.
You can also use the InputProps prop on the TextField component to achieve this by setting the disableUnderline property to true .
It depends on the browser version, but for most up to date browsers this CSS should do the work.
//remove X
input[type="time"]::-webkit-clear-button {
display: none;
}
//remove inside of arrows button
input[type="time"]::-webkit-inner-spin-button {
display: none;
}
//remove outsideof arrows button
input[type="time"]::-webkit-outside-spin-button {
display: none;
}
So based on your example, you need to edit textField style, so it would look like that
const styles = theme => ({
textField: {
marginLeft: theme.spacing.unit,
marginRight: theme.spacing.unit,
width: 200,
"& input::-webkit-clear-button, & input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button": {
display: "none"
}
}
});
But remember that it may not work for every browser. For example, to remove clear button on IE 10 you will need to use this CSS.
input[type="time"]::-ms-clear {
display: none;
}
You can check list of supported browsers in -webkit docs. Here is an example for -webkit-inner-spin-button
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With