UNPKG

@wordpress/components

Version:
52 lines (46 loc) 1.14 kB
import { createElement } from "@wordpress/element"; /** * External dependencies */ import classnames from 'classnames'; /** * WordPress dependencies */ import { forwardRef } from '@wordpress/element'; /** * Internal dependencies */ import PanelHeader from './header'; function UnforwardedPanel(_ref, ref) { let { header, className, children } = _ref; const classNames = classnames(className, 'components-panel'); return createElement("div", { className: classNames, ref: ref }, header && createElement(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> * ); * ``` */ export const Panel = forwardRef(UnforwardedPanel); export default Panel; //# sourceMappingURL=index.js.map