UNPKG

@wordpress/components

Version:
37 lines (31 loc) 858 B
import { createElement } from "@wordpress/element"; /** * WordPress dependencies */ import { memo } from '@wordpress/element'; /** * Internal dependencies */ import { ControlLabel } from '../control-label'; import VisuallyHidden from '../../visually-hidden'; /** * @param {import('../context').ViewOwnProps<import('./types').FormGroupLabelProps, 'label'>} props * @return {JSX.Element | null} The form group's label. */ function FormGroupLabel({ children, id, labelHidden = false, ...props }) { if (!children) return null; if (labelHidden) { return createElement(VisuallyHidden, { as: "label", htmlFor: id === null || id === void 0 ? void 0 : id.toString() }, children); } return createElement(ControlLabel, props, children); } export default memo(FormGroupLabel); //# sourceMappingURL=form-group-label.js.map