Skip to content

Commit e1b654c

Browse files
[fields] Add notch to the field outlined when the label is manually shrinked (#17620)
1 parent c677bc5 commit e1b654c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/x-date-pickers/src/PickersTextField/PickersTextField.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,14 @@ const PickersTextField = React.forwardRef(function PickersTextField(
148148

149149
const PickersInputComponent = VARIANT_COMPONENT[variant];
150150

151+
const inputAdditionalProps = {} as any;
152+
if (variant === 'outlined') {
153+
if (InputLabelProps && typeof InputLabelProps.shrink !== 'undefined') {
154+
inputAdditionalProps.notched = InputLabelProps.shrink;
155+
}
156+
inputAdditionalProps.label = label;
157+
}
158+
151159
return (
152160
<PickerTextFieldOwnerStateContext.Provider value={ownerState}>
153161
<PickersTextFieldRoot
@@ -196,6 +204,7 @@ const PickersTextField = React.forwardRef(function PickersTextField(
196204
aria-describedby={helperTextId}
197205
aria-live={helperTextId ? 'polite' : undefined}
198206
data-active-range-position={dataActiveRangePosition}
207+
{...inputAdditionalProps}
199208
{...InputProps}
200209
/>
201210
{helperText && (

0 commit comments

Comments
 (0)