-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
/
FormGroup.js
66 lines (61 loc) · 1.65 KB
/
FormGroup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import withStyles from '../styles/withStyles';
export const styles = {
/* Styles applied to the root element. */
root: {
display: 'flex',
flexDirection: 'column',
flexWrap: 'wrap',
},
/* Styles applied to the root element if `row={true}`. */
row: {
flexDirection: 'row',
},
};
/**
* `FormGroup` wraps controls such as `Checkbox` and `Switch`.
* It provides compact row layout.
* For the `Radio`, you should be using the `RadioGroup` component instead of this one.
*/
const FormGroup = React.forwardRef(function FormGroup(props, ref) {
const { classes, className, row = false, ...other } = props;
return (
<div
className={clsx(
classes.root,
{
[classes.row]: row,
},
className,
)}
ref={ref}
{...other}
/>
);
});
FormGroup.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
/**
* @ignore
*/
className: PropTypes.string,
/**
* Display group of elements in a compact row.
*/
row: PropTypes.bool,
};
export default withStyles(styles, { name: 'MuiFormGroup' })(FormGroup);