Ask Your Question
2

What is the method for altering the outline/border of a disabled OutlinedInput in MUI?

asked 2022-01-13 11:00:00 +0000

nofretete gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-02-10 03:00:00 +0000

qstack gravatar image

To alter the outline/border of a disabled OutlinedInput in MUI, you can use the MuiOutlinedInput-notchedOutline class and apply custom styling to it via CSS. You can use the border property to change the border style, color, and width. Here's an example:

import { withStyles } from '@material-ui/core/styles';
import OutlinedInput from '@material-ui/core/OutlinedInput';

const StyledOutlinedInput = withStyles(theme => ({
  notchedOutline: {
    borderColor: theme.palette.grey[400], // Change the border color
    borderWidth: 2, // Change the border width
    borderStyle: 'dashed', // Change the border style
  },
}))(OutlinedInput);

<StyledOutlinedInput disabled />

In this example, we're creating a new StyledOutlinedInput component that applies custom styling to the notchedOutline class. We're using the theme object to access the palette.grey property for the border color. We're also changing the border width and style to 2 and dashed, respectively. Finally, we're passing the disabled prop to the StyledOutlinedInput component to render a disabled input with the custom border styling.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-13 11:00:00 +0000

Seen: 11 times

Last updated: Feb 10 '23