@gechiui/components
Version:
UI components for GeChiUI.
44 lines (39 loc) • 1.05 kB
JavaScript
/**
* Internal dependencies
*/
import { contextConnect } from '../ui/context';
import { View } from '../view';
import { useVStack } from './hook';
/**
* @param {import('../ui/context').GeChiUIComponentProps<import('./types').Props, 'div'>} props
* @param {import('react').Ref<any>} forwardedRef
*/
function VStack( props, forwardedRef ) {
const vStackProps = useVStack( props );
return <View { ...vStackProps } ref={ forwardedRef } />;
}
/**
* `VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.
*
* `VStack` can render anything inside.
*
* @example
* ```jsx
* import {
* __experimentalText as Text,
* __experimentalVStack as VStack,
* } from `@gechiui/components`;
*
* function Example() {
* return (
* <VStack>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </VStack>
* );
* }
* ```
*/
const ConnectedVStack = contextConnect( VStack, 'VStack' );
export default ConnectedVStack;