Skip to content
Permalink
Browse files

fix(types): add bootstrap sizes for Form.Label as column (#3731)

* fix #3481 - add bootstrap sizes for Form.Label as column

* type FormLabelProps with type union

* make eslint happy

* add test case for Form.Label with column prop
  • Loading branch information
dalevfenton authored and jquense committed May 21, 2019
1 parent 8ba9b2b commit cdb7b6bb58f526947d23fedac4202085edc4adb6
Showing with 21 additions and 3 deletions.
  1. +12 −2 types/components/FormLabel.d.ts
  2. +9 −1 types/simple.test.tsx
@@ -1,14 +1,24 @@
import * as React from 'react';

import { BsPrefixComponent } from './helpers';
import { ColProps } from './Col';

export interface FormLabelProps {
interface FormLabelBaseProps {
htmlFor?: string;
column?: boolean;
innerRef?: React.LegacyRef<this>;
srOnly?: boolean;
}

export interface FormLabelOwnProps extends FormLabelBaseProps {
column?: false;
}

export interface FormLabelWithColProps extends FormLabelBaseProps, ColProps {
column: true;
}

export type FormLabelProps = FormLabelWithColProps | FormLabelOwnProps

declare class FormLabel extends BsPrefixComponent<'label', FormLabelProps> {}

export default FormLabel;
@@ -175,7 +175,7 @@ import {
</Form.Control>
</Form.Group>
<Form.Group controlId="exampleForm.ControlSelect2">
<Form.Label>Example multiple select</Form.Label>
<Form.Label column={false}>Example multiple select</Form.Label>
<Form.Control as="select">
<option>1</option>
<option>2</option>
@@ -188,6 +188,14 @@ import {
<Form.Label>Example textarea</Form.Label>
<Form.Control as="textarea" rows={3} />
</Form.Group>
<Form.Group as={Row} controlId="exampleForm.HorizontalControl">
<Form.Label column sm={2}>
Horizontal
</Form.Label>
<Col sm={10}>
<Form.Control type="text" placeholder="Hoizontal" />
</Col>
</Form.Group>
</Form>;

<div>

0 comments on commit cdb7b6b

Please sign in to comment.
You can’t perform that action at this time.