UNPKG

@wordpress/components

Version:
29 lines (26 loc) 731 B
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * Internal dependencies */ import { VisuallyHidden } from '../visually-hidden'; import { Label as BaseLabel, LabelWrapper } from './styles/input-control-styles'; export default function Label(_ref) { let { children, hideLabelFromVision, htmlFor, ...props } = _ref; if (!children) return null; if (hideLabelFromVision) { return createElement(VisuallyHidden, { as: "label", htmlFor: htmlFor }, children); } return createElement(LabelWrapper, null, createElement(BaseLabel, _extends({ htmlFor: htmlFor }, props), children)); } //# sourceMappingURL=label.js.map