UNPKG

@gechiui/components

Version:
49 lines (44 loc) 1.34 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@gechiui/element"; /** * External dependencies */ // eslint-disable-next-line no-restricted-imports /** * Internal dependencies */ import { contextConnect } from '../ui/context'; import { View } from '../view'; import { useSpacer } from './hook'; function Spacer(props, forwardedRef) { const spacerProps = useSpacer(props); return createElement(View, _extends({}, spacerProps, { ref: forwardedRef })); } /** * `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`. * * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`). * * @example * ```jsx * import { Spacer } from `@gechiui/components` * * function Example() { * return ( * <View> * <Spacer> * <Heading>www.GeChiUI.com</Heading> * </Spacer> * <Text> * Code is Poetry * </Text> * </View> * ); * } * ``` */ const ConnectedSpacer = contextConnect(Spacer, 'Spacer'); export default ConnectedSpacer; //# sourceMappingURL=component.js.map