How to make border none of mui select in react js?
February 07, 2023Hi Friends 👋,
Welcome To aGuideHub!
To make border none of mui select in React js, you can use border: none !important;
to .MuiOutlinedInput-notchedOutline
. It will make border none of mui select in React js.
Today, I am going to show you, how to make border none of mui select in react js.
Installation
Install the following packages to use border none of mui select in react js.
npm
npm install @mui/material @emotion/react @emotion/styled
yarn
yarn add @mui/material @emotion/react @emotion/styled
MUI material make border none of mui select example.
The below code is an example of making mui border none of mui select using.
App.js
import * as React from 'react';
import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem';
import FormControl from '@mui/material/FormControl';
import Select from '@mui/material/Select';
import "./App.css"
export default function SelectAutoWidth() {
const [age, setAge] = React.useState('');
const handleChange = (event) => {
setAge(event.target.value);
};
return (
<div>
<FormControl sx={{ m: 1, minWidth: 200 }} >
<InputLabel id="demo-simple-select-autowidth-label">Age</InputLabel>
<Select
labelId="demo-simple-select-autowidth-label"
id="demo-simple-select-autowidth"
value={age}
onChange={handleChange}
autoWidth
label="Age"
>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Twenty</MenuItem>
<MenuItem value={21}>Twenty one</MenuItem>
<MenuItem value={22}>Twenty one and a half</MenuItem>
</Select>
</FormControl>
</div>
);
}
.MuiOutlinedInput-notchedOutline {
border: none !important;
}
In the above code example, I have used the @mui/material
component and made border none of mui select.
Check the output of the above code example.
Here, we are provided code sandbox links for the above program make border none of mui select. Then you can use whenever you want and do the changes as per your requirements.
All the best 👍