@activecollab/components
Version:
ActiveCollab Components
29 lines • 866 B
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import React, { forwardRef } from "react";
import classNames from "classnames";
import { Typography } from "../Typography/Typography";
export const Label = /*#__PURE__*/forwardRef((_ref, ref) => {
let {
invalid = false,
required = false,
size = "regular",
children,
className,
weight = "bold",
htmlFor,
...props
} = _ref;
const color = invalid ? "alert" : "primary";
const variant = size === "regular" ? "Body 2" : "Caption 1";
return /*#__PURE__*/React.createElement(Typography, _extends({
as: "label",
className: classNames("c-label", className),
variant: variant,
color: color,
weight: weight,
ref: ref,
htmlFor: htmlFor
}, props), children, required ? "*" : null);
});
Label.displayName = "Label";
//# sourceMappingURL=Label.js.map