Skip to content

Commit

Permalink
mui: fix gap in outline when label is hidden
Browse files Browse the repository at this point in the history
Passing `label={false}` to the MUI text/select widgets results in a
gap in the widget outline where the label would be.  Instead, to hide
the label without a gap, we must pass `label={undefined}`.

This commit changes the calls to `labelValue(...)` for
BaseInputTemplatea and SelectWidget to return `undefined` when
`"ui:label": false` was specified.
  • Loading branch information
drbild committed Nov 30, 2023
1 parent ac6b3b0 commit 75dd923
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
should change the heading of the (upcoming) version to include a major version bump.
-->
# 5.14.5

## @rjsf/mui

- fix gap in text and select widget outlines when `"ui:label": false` is specified.

# 5.14.4

## @rjsf/utils
Expand Down
2 changes: 1 addition & 1 deletion packages/mui/src/BaseInputTemplate/BaseInputTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function BaseInputTemplate<
id={id}
name={id}
placeholder={placeholder}
label={labelValue(label || undefined, hideLabel, false)}
label={labelValue(label || undefined, hideLabel, undefined)}
autoFocus={autofocus}
required={required}
disabled={disabled || readonly}
Expand Down
2 changes: 1 addition & 1 deletion packages/mui/src/SelectWidget/SelectWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function SelectWidget<
<TextField
id={id}
name={id}
label={labelValue(label || undefined, hideLabel, false)}
label={labelValue(label || undefined, hideLabel, undefined)}
value={!isEmpty && typeof selectedIndexes !== 'undefined' ? selectedIndexes : emptyValue}
required={required}
disabled={disabled || readonly}
Expand Down

0 comments on commit 75dd923

Please sign in to comment.