@gechiui/components
Version:
UI components for GeChiUI.
38 lines (32 loc) • 997 B
JavaScript
/**
* Internal dependencies
*/
import { contextConnect } from '../ui/context';
import { View } from '../view';
import { useScrollable } from './hook';
/**
* @param {import('../ui/context').GeChiUIComponentProps<import('./types').Props, 'div'>} props
* @param {import('react').Ref<any>} forwardedRef
*/
function Scrollable( props, forwardedRef ) {
const scrollableProps = useScrollable( props );
return <View { ...scrollableProps } ref={ forwardedRef } />;
}
/**
* `Scrollable` is a layout component that content in a scrollable container.
*
* @example
* ```jsx
* import { __experimentalScrollable as Scrollable } from `@gechiui/components`;
*
* function Example() {
* return (
* <Scrollable style={ { maxHeight: 200 } }>
* <div style={ { height: 500 } }>...</div>
* </Scrollable>
* );
* }
* ```
*/
const ConnectedScrollable = contextConnect( Scrollable, 'Scrollable' );
export default ConnectedScrollable;