Reputation: 37
I have this component from material-ui/pickers:
<KeyboardDatePicker
value={selectedDate}
onChange={(_, newValue) => handleClick(newValue)}
labelFunc={renderLabel}
disableToolbar
variant='inline'
inputVariant='filled'
format='YYYYMMDD'
allowKeyboardControl
autoOk
inputProps={{
'data-testid': `input-${name}`
}}
InputAdornmentProps={{ position: 'start' }}
/>
This property is causing the problem. Without it the style is fine an the icon is centered vertically in the component. When I try to move the icon to the beginning of the component there appears an extra style:
.MuiInputAdornment-filled.MuiInputAdornment-positionStart:not(.MuiInputAdornment-hiddenLabel) {
margin-top: 16px;
}
That causes icon to be off-center. This is what it looks like without InputAdornmentProps: [1]: https://i.sstatic.net/xxGaM.png
And with it: [2]: https://i.sstatic.net/dHA53.png
What could be causing it?
Upvotes: 1
Views: 6696
Reputation: 433
For me, what solved this issue was specify the KeyboardButtonProp - edge: "start. See here https://material-ui.com/api/icon-button/
Upvotes: 0