score:1
Accepted answer
i'm not sure why your code didn't work, but i've found a workaround by specifying the switch input classname directly like this:
import switch, { switchclasses } from "@mui/material/switch";
import { createtheme, themeprovider } from "@mui/material/styles";
const theme = createtheme({
components: {
muiswitch: {
styleoverrides: {
root: {
[`& .${switchclasses.input}`]: {
position: "absolute"
}
},
switchbase: {
color: "red"
}
}
}
}
});
live demo
Source: stackoverflow.com
Related Query
- Material-UI v5 override MuiSwitch input
- Material UI Select Component- A component is changing a controlled input of type text to be uncontrolled
- Remove underline from Input component Material UI (v1.0 Beta)
- How to override Material UI .MuiContainer-maxWidthLg?
- react-hook-form's setValue method is not working if input is in material ui dialog
- How to change outline color of Material UI React input component?
- Override Material UI Button Text
- Dropdown with custom input in material ui
- Material UI | How to change the font colour of a disabled input text field?
- readOnly is not applying for input field of KeyboardDatePicker of material ui in react js
- How to override .MuiTypography-body1 class in Material UI
- Override Material UI MuiInput
- How to override style of nested Material UI component from the ancestors?
- Add suffix follow by user input material ui TextField
- Unable to change border color when focused and not focused of Material UI Input
- How to override Amplify theming with Material UI
- Material UI Input aligned to Select
- Material-ui v1 Input focus style override
- Load Material UI AutoComplete suggestions after user input
- How to override Box created by TabPanel in Material UI
- How to get input value of TextField from Material UI without using onChange event?
- Autocomplete with custom input in material ui not working
- React Testing Library: Unable to Change Material UI DatePicker Input Value
- Material UI Select override Position in theme
- How to get input value of TextField from Material UI?
- How to fix placeholder text within the input in material ui text field
- How to override material ui shadows in the theme
- How do I override icons in Material UI DataGrid?
- How to override global border color styles for disabled Material UI TextField?
- Material UI nested class override
More Query from same tag
- Creating a text highlight in the background using javascript at give start and end indexes
- How to input an existing value into an input field in React for an edit form
- How to hide button OnClick when saving a pdf in react using jsPDF?
- Display new button on onClick(); ReactJS
- Exported plain component is still expecting a store during test
- React - 2 input field dependent on each other - infinite loop
- How to add 'checked' to a select item in React?
- Websocket is undefined immediately after receiving message in react
- React not able to dynamically render correct component
- React useState with the output of a ternary expression
- Creating excerpts using Contentfuls rich text react render
- "Cannot use import statement outside a module" error when importing react-hook-mousetrap in Next.js
- remove imported styles when component unmounts
- React Hook "useState" cannot be called inside a callback
- Lazy loading pages with BrowserRouter Lazy and Suspense
- JavaScript inner lambda function without var, let or const
- React not rendering simple component
- React - Imported array of objects not reversing
- React loading screen on all routes?
- Emoji Picker in Slack-Clone Project
- Make the Google Maps Javascript API sit in a container in React
- cannot render mui icon in react ternary condition
- How to make autosuggest suggestions overflow the dialog container?
- How to fetch data in react server side rendering based on dynamic routing path
- TypeError: Cannot read property 'attach' of undefined makeStyles.js
- Updating/editing username in dropdown list in react
- Display json data in table (react, material.ui)
- How to correctly make side effects during rendering on functional components?
- Material UI: How to display my array of objects into a material ui table
- Restricting type of children