UNPKG

@wordpress/components

Version:
40 lines (35 loc) 993 B
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@wordpress/element"; /** * External dependencies */ /** * Internal dependencies */ import { contextConnect } from '../ui/context'; import { View } from '../view'; import { useScrollable } from './hook'; function UnconnectedScrollable(props, forwardedRef) { const scrollableProps = useScrollable(props); return createElement(View, _extends({}, 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> * ); * } * ``` */ export const Scrollable = contextConnect(UnconnectedScrollable, 'Scrollable'); export default Scrollable; //# sourceMappingURL=component.js.map