remove padding of the textbox which comes from material ui

user10509524

I am trying to remove the padding from a textbox but the problem is it's coming from the Material UI.

I gave padding 0 for all the classes but padding is still not getting removed.

Can you tell me how to remove this padding?

.MuiOutlinedInput-input-1708 {
    padding: 18.5px 14px;
}

Here is my code and a sandbox:

https://codesandbox.io/s/m58841kkwp

cssLabel: {
    "&$cssFocused": {
      color: { borderColor: "red", padding: 0 }
    }
  },
  cssFocused: { borderColor: "red", padding: 0 },
  cssUnderline: {
    "&:after": {
      borderBottomColor: "red",
      padding: 0
    }
  },
  // cssOutlinedInput: {
  //   "&$cssFocused $notchedOutline": {
  //     borderColor: "green"
  //   }
  // },

  cssOutlinedInput: {
    "& $notchedOutline": {
      //add this nested selector
      borderColor: "red",
      padding: 0
    },

    "&$cssFocused $notchedOutline": {
      borderColor: "green",
      padding: 0
    }
  },

  notchedOutline: { borderColor: "red", padding: 0 },
GonzaH

one way to solve it could be to create a useful class and overwrite the styles of the material text field. This way you will make it reusable

I leave the example https://stackblitz.com/edit/react-textfield-without-padding

Note: I left it with a 5px padding to make it look better as an example. You can customize it so you do not have padding

Useful resources

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Material UI remove Menu padding

Cant remove padding-bottom from Card Content in Material UI

How to remove default padding from material ui List Item?

Remove padding from Material UI SwipeableViews React [SOLVED]

Unable to remove padding from material-ui TabPane

React material ui responsive drawer - I want to remove the padding from the Toolbar

How to remove padding from angular material datepicker

Remove border around material-ui v4 textbox

Remove year from material-ui datepicker

Remove label from filled DesktopDatePicker Material UI

Disable padding in material ui card

How can i remove padding bottom in React material UI Card "MuiCardContent-root:last-child" default padding bottom?

What are themes when it comes to Material UI?

Material-UI app bar comes with a margin

Know from which class it comes

Remove padding from string

How to remove the content padding that the list tile comes with by default?

Cannot set padding to 0 on Material UI Button

How to change padding of Material UI's datepicker?

Material UI: Remove up/down arrow dials from TextView

How to remove the arrows icons from a Material UI TextField

How to remove hover from button? Material UI v5

How can I remove the underline of TextField from Material-UI?

React - Material UI: How to remove scrollbar from table

Remove blue outline from Select box React Material UI

Remove a div from Material UI's Date Picker

Display data which comes from a Golang controller

How to tell which module a type comes from?

Assigning a value which comes from a loop to an array

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  6. 6

    BigQuery - concatenate ignoring NULL

  7. 7

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  8. 8

    ggplotly no applicable method for 'plotly_build' applied to an object of class "NULL" if statements

  9. 9

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  10. 10

    How to remove the extra space from right in a webview?

  11. 11

    java.lang.NullPointerException: Cannot read the array length because "<local3>" is null

  12. 12

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  13. 13

    flutter: dropdown item programmatically unselect problem

  14. 14

    How to use merge windows unallocated space into Ubuntu using GParted?

  15. 15

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  16. 16

    Nuget add packages gives access denied errors

  17. 17

    Svchost high CPU from Microsoft.BingWeather app errors

  18. 18

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  19. 19

    12.04.3--- Dconf Editor won't show com>canonical>unity option

  20. 20

    Any way to remove trailing whitespace *FOR EDITED* lines in Eclipse [for Java]?

  21. 21

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

HotTag

Archive