[TextField + Icon] Leading icon has incorrect padding
See original GitHub issueBug report
Steps to reproduce
Taken from discord For icon button necessary to use mdc-text-field__icon–trailing.margin-right: 4px; Stille like this for prefix and suffix
/* TEXTFIELD PREFIX SUFFIX */
.mdc-text-field__affix--prefix {
padding-right: 4px;
}
.mdc-text-field__affix--suffix {
padding-left: 4px;
}
And
Final code
/* TEXTFIELD HELPER LINE */
.mdc-text-field+.mdc-text-field-helper-line {
justify-content: left;
padding: 0 14px;
}
/* TEXTFIELD ICONS */
.mdc-text-field {
.mdc-icon-button {
@include icon-button.size(44px);
}
}
.mdc-text-field__icon--leading,
.mdc-text-field__icon--trailing {
padding: 10px;
}
.mdc-text-field__icon--leading {
margin: 0 4px;
}
.mdc-text-field__icon--trailing {
margin: 0 4px;
}
.mdc-text-field--with-leading-icon {
&.mdc-text-field--filled {
.mdc-floating-label {
left: 52px;
}
}
}
/* TEXTFIELD PREFIX SUFFIX */
.mdc-text-field__affix--prefix {
padding-right: 4px;
}
.mdc-text-field__affix--suffix {
padding-left: 4px;
}
Actual behavior
Expected behavior
Screenshots
Your Environment:
Software | Version(s) |
---|---|
MDC Web | 8.0.0 |
Browser | Opera/Chrome |
Operating System | Windows |
Additional context
Possible solution
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
remove default padding on jetpack compose textfield
If you wish to disable it, an alternative could be to set the height of the TextField explicitly, and matching it with the...
Read more >Validation · Bootstrap v5.0
When attempting to submit, you'll see the :invalid and :valid styles applied to your form controls. Custom feedback styles apply custom colors, borders,...
Read more >androidx.compose.material - Android Developers
Represents the colors of the input text, background and content (including label, placeholder, leading and trailing icons) used in a text field in...
Read more >TextInput - Mantine
TextInput · Usage · Controlled · Invalid state and error · Disabled state · With icon · With right section · Get input...
Read more ><input type="search"> - HTML: HyperText Markup Language
The first thing to note is that some browsers show a cross icon that can ... input:invalid ~ span::after { content: "✖"; padding-left:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d like to chime in that the *icon–leading and *icon–trailing do not have a 48x48px touch target - It is a side-effect of using material-icon. If one would swap out the iconset for font-awesome (for example), it is not enforced, offsetting the floating label.
I would suggest adding the sizing to the relevant
.mdc-text-field__icon
This floating-label offset is also happening in the select component with.mdc-select__icon
.