UNPKG

@wordpress/components

Version:
34 lines (33 loc) • 1.05 kB
import clsx from "clsx"; import { forwardRef } from "@wordpress/element"; import PanelHeader from "./header.mjs"; import { jsx, jsxs } from "react/jsx-runtime"; // packages/components/src/panel/index.tsx function UnforwardedPanel({ header, className, children }, ref) { const classNames = clsx(className, "components-panel"); return /* @__PURE__ */ jsxs("div", { className: classNames, ref, children: [header && /* @__PURE__ */ jsx(PanelHeader, { label: header }), children] }); } /** * `Panel` expands and collapses multiple sections of content. * * ```jsx * import { Panel, PanelBody, PanelRow } from '@wordpress/components'; * import { more } from '@wordpress/icons'; * * const MyPanel = () => ( * <Panel header="My Panel"> * <PanelBody title="My Block Settings" icon={ more } initialOpen={ true }> * <PanelRow>My Panel Inputs and Labels</PanelRow> * </PanelBody> * </Panel> * ); * ``` */ const Panel = forwardRef(UnforwardedPanel); Panel.displayName = "Panel"; export { Panel, Panel as default }; //# sourceMappingURL=index.mjs.map