@wordpress/components
Version:
UI components for WordPress.
31 lines (30 loc) • 940 B
JavaScript
import { contextConnect } from "../context/index.mjs";
import { View } from "../view/index.mjs";
import { useScrollable } from "./hook.mjs";
import { jsx } from "react/jsx-runtime";
// packages/components/src/scrollable/component.tsx
function UnconnectedScrollable(props, forwardedRef) {
const scrollableProps = useScrollable(props);
return /* @__PURE__ */ jsx(View, {
...scrollableProps,
ref: forwardedRef
});
}
/**
* `Scrollable` is a layout component that content in a scrollable container.
*
* ```jsx
* import { __experimentalScrollable as Scrollable } from `@wordpress/components`;
*
* function Example() {
* return (
* <Scrollable style={ { maxHeight: 200 } }>
* <div style={ { height: 500 } }>...</div>
* </Scrollable>
* );
* }
* ```
*/
const Scrollable = contextConnect(UnconnectedScrollable, "Scrollable");
export { Scrollable, Scrollable as default, UnconnectedScrollable };
//# sourceMappingURL=component.mjs.map