Skip to content

Commit 52e92fc

Browse files
authored
fix(FormLabel): Add missing class for col label sizing (react-bootstrap#5382)
1 parent 62a9d8b commit 52e92fc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/FormLabel.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ const FormLabel: FormLabel = React.forwardRef(
8989
bsPrefix = useBootstrapPrefix(bsPrefix, 'form-label');
9090

9191
let columnClass = 'col-form-label';
92-
if (typeof column === 'string') columnClass = `${columnClass}-${column}`;
92+
if (typeof column === 'string')
93+
columnClass = `${columnClass} ${columnClass}-${column}`;
94+
9395
const classes = classNames(
9496
className,
9597
bsPrefix,

test/FormLabelSpec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ describe('<FormLabel>', () => {
7777

7878
it('should properly size itself when rendered as a Col', () => {
7979
mount(<FormLabel column="sm">Label</FormLabel>).assertSingle(
80-
'label.col-form-label-sm',
80+
'label.col-form-label.col-form-label-sm',
8181
);
8282
mount(<FormLabel column>Label</FormLabel>).assertSingle(
8383
'label.col-form-label',
8484
);
8585
mount(<FormLabel column="lg">Label</FormLabel>).assertSingle(
86-
'label.col-form-label-lg',
86+
'label.col-form-label.col-form-label-lg',
8787
);
8888
let labelComponent = mount(<FormLabel>Label</FormLabel>);
8989
labelComponent.assertNone('label.col-form-label');

0 commit comments

Comments
 (0)