@wordpress/components
Version:
UI components for WordPress.
38 lines (32 loc) • 909 B
JavaScript
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').WordPressComponentProps<import('./types').FormGroupLabelProps, 'label', false>} props
* @return {JSX.Element | null} The form group's label.
*/
function FormGroupLabel(_ref) {
let {
children,
id,
labelHidden = false,
...props
} = _ref;
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