Skip to main content

CSS

Like any component, if you want to override a component's styles using custom classes, you can use the className prop.

<MuiTelInput className="my-class-name" />

Then, you can use the differents global class names (see below) to target an element of MuiTelInput. Classes are also abstracted and exported as classes, to keep a stable interface for consumers.

Global classexported constantDescription
.MuiTelInput-TextFieldclasses.textFieldStyles applied to the root element.
.MuiTelInput-IconButtonclasses.flagButtonStyles applied to the IconButton of the current flag.
.MuiTelInput-Flagclasses.flagContainerStyles applied to the element around the image of a flag.
.MuiTelInput-FlagImgclasses.flagImgStyles applied to the image within a flag element.
.MuiTelInput-Menuclasses.menuStyles applied to Menu component.
.MuiTelInput-MenuItemclasses.menuItemStyles applied to a flag item of the Menu.
.MuiTelInput-ListItemIcon-flagclasses.listItemIconFlagStyles applied to the ListItemIcon of a flag item
.MuiTelInput-ListItemText-countryclasses.listItemTextCountryStyles applied to the ListItemText of a flag item
.MuiTelInput-Typography-calling-codeclasses.callingCodeStyles applied to the calling code of a flag item

For example: target the .MuiTelInput-Flag global class name to customize the current selected flag.

Example with styled-component / emotion

import { styled } from 'styled-component' // or emotion
import { MuiTelInput } from 'mui-tel-input'

const MuiTelInputStyled = styled(MuiTelInput)`
& input {
color: red;
}
`

function MyComponent() {
return <MuiTelInputStyled />
}

Or using classes:

import { styled } from 'styled-component' // or emotion
import { MuiTelInput, classes } from 'mui-tel-input'

const WithStyledFlag = styled(MuiTelInput)`
.${classes.flag} > img {
filter: grayscale(100%);
width: 20px;
}
`

function MyComponent() {
return <WithStyledFlag />
}