Skip to content

Commit 554a4d6

Browse files
committed
Fix <SelectInput> shows gap in border when using no label with outlined variant
1 parent 7a322df commit 554a4d6

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

packages/ra-ui-materialui/src/input/SelectInput.stories.tsx

+39
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,45 @@ export const Disabled = () => (
101101
</Wrapper>
102102
);
103103

104+
export const Variant = ({ hideLabel }) => (
105+
<Wrapper>
106+
<SelectInput
107+
source="gender"
108+
choices={[
109+
{ id: 'M', name: 'Male ' },
110+
{ id: 'F', name: 'Female' },
111+
]}
112+
label={hideLabel ? false : 'default'}
113+
/>
114+
<SelectInput
115+
source="gender"
116+
choices={[
117+
{ id: 'M', name: 'Male ' },
118+
{ id: 'F', name: 'Female' },
119+
]}
120+
label={hideLabel ? false : 'outlined'}
121+
variant="outlined"
122+
/>
123+
<SelectInput
124+
source="gender"
125+
choices={[
126+
{ id: 'M', name: 'Male ' },
127+
{ id: 'F', name: 'Female' },
128+
]}
129+
label={hideLabel ? false : 'standard'}
130+
variant="standard"
131+
/>
132+
</Wrapper>
133+
);
134+
Variant.args = {
135+
hideLabel: false,
136+
};
137+
Variant.argTypes = {
138+
hideLabel: {
139+
type: 'boolean',
140+
},
141+
};
142+
104143
export const ReadOnly = () => (
105144
<Wrapper>
106145
<SelectInput

packages/ra-ui-materialui/src/input/SelectInput.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,14 @@ export const SelectInput = (props: SelectInputProps) => {
306306
onChange={handleChangeWithCreateSupport}
307307
select
308308
label={
309-
label !== '' &&
310-
label !== false && (
309+
label !== '' && label !== false ? (
311310
<FieldTitle
312311
label={label}
313312
source={source}
314313
resource={resourceProp}
315314
isRequired={isRequired}
316315
/>
317-
)
316+
) : null
318317
}
319318
clearAlwaysVisible
320319
error={!!fetchError || invalid}

0 commit comments

Comments
 (0)