@blueprintjs/core
Version:
Core styles & components
31 lines • 1.46 kB
JavaScript
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
import classNames from "classnames";
import * as React from "react";
import * as Classes from "../../common/classes";
import { DISPLAYNAME_PREFIX } from "../../common/props";
export class FormGroup extends React.PureComponent {
render() {
const { children, contentClassName, helperText, label, labelFor, labelInfo, style } = this.props;
return (React.createElement("div", { className: this.getClassName(), style: style },
label && (React.createElement("label", { className: Classes.LABEL, htmlFor: labelFor },
label,
" ",
React.createElement("span", { className: Classes.TEXT_MUTED }, labelInfo))),
React.createElement("div", { className: classNames(Classes.FORM_CONTENT, contentClassName) },
children,
helperText && React.createElement("div", { className: Classes.FORM_HELPER_TEXT }, helperText))));
}
getClassName() {
const { className, disabled, inline, intent } = this.props;
return classNames(Classes.FORM_GROUP, Classes.intentClass(intent), {
[Classes.DISABLED]: disabled,
[Classes.INLINE]: inline,
}, className);
}
}
FormGroup.displayName = `${DISPLAYNAME_PREFIX}.FormGroup`;
//# sourceMappingURL=formGroup.js.map