@wordpress/components
Version:
UI components for WordPress.
35 lines (34 loc) • 1.01 kB
JavaScript
import { contextConnect } from "../../context/index.mjs";
import { Scrollable } from "../../scrollable/index.mjs";
import { View } from "../../view/index.mjs";
import { useCardBody } from "./hook.mjs";
import { jsx } from "react/jsx-runtime";
// packages/components/src/card/card-body/component.tsx
function UnconnectedCardBody(props, forwardedRef) {
const { isScrollable, ...otherProps } = useCardBody(props);
if (isScrollable) return /* @__PURE__ */ jsx(Scrollable, {
...otherProps,
ref: forwardedRef
});
return /* @__PURE__ */ jsx(View, {
...otherProps,
ref: forwardedRef
});
}
/**
* `CardBody` renders an optional content area for a `Card`.
* Multiple `CardBody` components can be used within `Card` if needed.
*
* ```jsx
* import { Card, CardBody } from `@wordpress/components`;
*
* <Card>
* <CardBody>
* ...
* </CardBody>
* </Card>
* ```
*/
const CardBody = contextConnect(UnconnectedCardBody, "CardBody");
export { CardBody, CardBody as default };
//# sourceMappingURL=component.mjs.map