@wordpress/components
Version:
UI components for WordPress.
32 lines (31 loc) • 917 B
JavaScript
// packages/components/src/menu/group-label.tsx
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";
var GroupLabel2 = 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 {
GroupLabel2 as GroupLabel
};
//# sourceMappingURL=group-label.js.map