Skip to Content
Lynx

HStack

HStack 컴포넌트는 Lynx에서 자식 요소를 가로 방향으로 쌓는 레이아웃 컴포넌트입니다.

사용을 권장하지 않아요

레이아웃은 사용 중인 zero-runtime 스타일링 라이브러리로 구성하는 것을 권장합니다. 이유와 대체 예제는 Styling 가이드에서 확인하세요.

Installation

npm install @seed-design/lynx-react @seed-design/lynx-css

Usage

import { Box, HStack, Text } from "@seed-design/lynx-react";

export function App() {
  return (
    <HStack gap="x2" align="center" justify="spaceBetween">
      <Box bg="bg.brandWeak" borderRadius="r2" px="x3" py="x2">
        <Text textStyle="t3Bold" color="fg.brand">
          A
        </Text>
      </Box>
      <Box bg="bg.positiveWeak" borderRadius="r2" px="x3" py="x2">
        <Text textStyle="t3Bold" color="fg.positive">
          B
        </Text>
      </Box>
    </HStack>
  );
}

HStack은 Lynx 네이티브 <view>를 직접 렌더링하며 display="flex"와 flexDirection="row"를 기본 적용합니다. Box를 내부에서 합성하지 않아 반복 렌더링에서 primitive 컴포넌트 단계를 줄입니다.

Props

Prop

Type

bg?ScopedColorBanner | ScopedColorBg | ScopedColorPalette | (string & {}) | undefined
background?ScopedColorBanner | ScopedColorBg | ScopedColorPalette | (string & {}) | undefined
color?ScopedColorFg | ScopedColorPalette | (string & {}) | undefined
borderColor?ScopedColorPalette | ScopedColorStroke | (string & {}) | undefined
borderWidth?0 | 1 | (string & {}) | undefined
borderTopWidth?0 | 1 | (string & {}) | undefined
borderRightWidth?0 | 1 | (string & {}) | undefined
borderBottomWidth?0 | 1 | (string & {}) | undefined
borderLeftWidth?0 | 1 | (string & {}) | undefined
borderRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderTopLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderTopRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderBottomRightRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
borderBottomLeftRadius?"full" | "r0_5" | "r1" | "r1_5" | "r2" | "r2_5" | "r3" | "r3_5" | "r4" | "r5" | "r6" | 0 | (string & {}) | undefined
width?"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {}) | undefined
minWidth?"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {}) | undefined
maxWidth?"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {}) | undefined
height?"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {}) | undefined
minHeight?"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {}) | undefined
maxHeight?"full" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | Dimension | (string & {}) | undefined
top?0 | (string & {}) | undefined
left?0 | (string & {}) | undefined
right?0 | (string & {}) | undefined
bottom?0 | (string & {}) | undefined
padding?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
p?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
paddingX?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
px?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
paddingY?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
py?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
paddingTop?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
pt?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
paddingRight?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
pr?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
paddingBottom?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
pb?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
paddingLeft?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
pl?"safeArea" | "spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
position?"absolute" | "fixed" | "relative" | (string & {}) | undefined
overflowX?"hidden" | "visible" | (string & {}) | undefined
overflowY?"hidden" | "visible" | (string & {}) | undefined
zIndex?Property.ZIndex | undefined
justifySelf?Property.JustifySelf | undefined
alignContent?"center" | "flexEnd" | "flexStart" | "stretch" | (string & {}) | undefined
alignSelf?"center" | "flexEnd" | "flexStart" | "stretch" | (string & {}) | undefined
gap?"spacingX.betweenChips" | "spacingX.globalGutter" | "spacingY.betweenText" | "spacingY.componentDefault" | "spacingY.navToTitle" | "spacingY.screenBottom" | 0 | Dimension | (string & {}) | undefined
bleed?BleedValue | undefined
bleedX?BleedValue | undefined
bleedY?BleedValue | undefined
bleedTop?BleedValue | undefined
bleedRight?BleedValue | undefined
bleedBottom?BleedValue | undefined
bleedLeft?BleedValue | undefined
margin?MarginValue | undefined
m?MarginValue | undefined
marginX?MarginValue | undefined
mx?MarginValue | undefined
marginY?MarginValue | undefined
my?MarginValue | undefined
marginTop?MarginValue | undefined
mt?MarginValue | undefined
marginRight?MarginValue | undefined
mr?MarginValue | undefined
marginBottom?MarginValue | undefined
mb?MarginValue | undefined
marginLeft?MarginValue | undefined
ml?MarginValue | undefined
align?"center" | "flexEnd" | "flexStart" | "stretch" | (string & {}) | undefined
justify?"center" | "flexEnd" | "flexStart" | "spaceAround" | "spaceBetween" | (string & {}) | undefined
wrap?"nowrap" | "wrap" | boolean | undefined
grow?boolean | Property.FlexGrow | undefined
shrink?boolean | Property.FlexShrink | undefined

Layout Aliases

HStack은 VStack과 동일한 alias를 제공합니다.

Prop적용되는 style
alignalignItems
justifyjustifyContent
wrapflexWrap
growflexGrow
shrinkflexShrink

가로 방향에서 줄바꿈이 필요하면 wrap을 사용합니다.

<HStack gap="x2" wrap>
  <Box px="x3" py="x1" borderRadius="full" bg="bg.neutralWeak">
    <Text>chip</Text>
  </Box>
  <Box px="x3" py="x1" borderRadius="full" bg="bg.neutralWeak">
    <Text>chip</Text>
  </Box>
</HStack>

웹 버전과의 차이

Lynx HStack은 React HStack과 다음과 같은 차이가 있습니다.

  • as, asChild를 지원하지 않습니다. 항상 Lynx 네이티브 <view>를 렌더링합니다.
  • 지원하지 않는 StyleProps는 Box와 동일하게 열지 않습니다.

Last updated on

목차