@wordpress/components
Version:
UI components for WordPress.
31 lines (30 loc) • 855 B
JavaScript
import { forwardRef, useContext } from "@wordpress/element";
import { Context } from "./context";
import { Text } from "../text";
import * as Styled from "./styles";
import { jsx as _jsx } from "react/jsx-runtime";
const GroupLabel = forwardRef(function Group(props, ref) {
const menuContext = useContext(Context);
if (!menuContext?.store) {
throw new Error("Menu.GroupLabel can only be rendered inside a Menu component");
}
return /* @__PURE__ */ _jsx(Styled.GroupLabel, {
ref,
render: (
// @ts-expect-error The `children` prop is passed
/* @__PURE__ */ _jsx(Text, {
upperCase: true,
variant: "muted",
size: "11px",
weight: 500,
lineHeight: "16px"
})
),
...props,
store: menuContext.store
});
});
export {
GroupLabel
};
//# sourceMappingURL=group-label.js.map