Action Button
명확한 액션을 쉽게 수행할 수 있도록 돕는 기본 인터랙션 컴포넌트입니다.
npm install @seed-design/lynx-react @seed-design/lynx-css
pnpm add @seed-design/lynx-react @seed-design/lynx-css
yarn add @seed-design/lynx-react @seed-design/lynx-css
bun add @seed-design/lynx-react @seed-design/lynx-css
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton>라벨</ActionButton>;
}
flexGrow?boolean | Property.FlexGrow | undefined
bleed?BleedValue | undefined
bleedX?BleedValue | undefined
bleedY?BleedValue | undefined
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton variant="brandSolid">라벨</ActionButton>;
}
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton variant="neutralSolid">라벨</ActionButton>;
}
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton variant="neutralWeak">라벨</ActionButton>;
}
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton variant="criticalSolid">라벨</ActionButton>;
}
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton variant="brandOutline">라벨</ActionButton>;
}
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton variant="neutralOutline">라벨</ActionButton>;
}
Lynx에서는 기본 Ghost 스타일을 지원합니다. 웹의 color, fontWeight 사용자 지정은 지원하지 않습니다.
import IconTagFill from "@karrotmarket/lynx-monochrome-icon/IconTagFill";
import { ActionButton, PrefixIcon } from "@seed-design/lynx-react";
export default function Example() {
return (
<ActionButton variant="ghost">
<PrefixIcon icon={<IconTagFill />} />
Default (fg.neutral)
</ActionButton>
);
}
import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill";
import { ActionButton, Icon } from "@seed-design/lynx-react";
export default function Example() {
return (
<ActionButton layout="iconOnly" accessibility-label="추가">
<Icon icon={<IconPlusFill />} />
</ActionButton>
);
}
import IconPlusFill from "@karrotmarket/lynx-monochrome-icon/IconPlusFill";
import { ActionButton, PrefixIcon } from "@seed-design/lynx-react";
export default function Example() {
return (
<ActionButton>
<PrefixIcon icon={<IconPlusFill />} />
라벨
</ActionButton>
);
}
import IconChevronRightFill from "@karrotmarket/lynx-monochrome-icon/IconChevronRightFill";
import { ActionButton, SuffixIcon } from "@seed-design/lynx-react";
export default function Example() {
return (
<ActionButton>
라벨
<SuffixIcon icon={<IconChevronRightFill />} />
</ActionButton>
);
}
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
return <ActionButton disabled>라벨</ActionButton>;
}
import { useState } from "@lynx-js/react";
import { ActionButton } from "@seed-design/lynx-react";
export default function Example() {
const [loading, setLoading] = useState(false);
function handleTap() {
"background only";
setLoading(true);
setTimeout(() => setLoading(false), 2000);
}
return (
<ActionButton loading={loading} bindtap={handleTap}>
시간이 걸리는 액션
</ActionButton>
);
}
bleed, bleedX, bleedY는 버튼에 음수 margin을 적용합니다. Ghost 버튼을 주변 콘텐츠와 시각적으로 정렬할 때 사용할 수 있습니다.
import { ActionButton, HStack, Text, VStack } from "@seed-design/lynx-react";
export default function Example() {
return (
<VStack width="100%" gap="x4">
<HStack
align="center"
justify="space-between"
py="x2"
borderWidth={1}
borderColor="palette.red600"
>
<Text textStyle="t6Regular">세로 Bleed</Text>
<ActionButton bleedY="8px" variant="brandSolid">
Bleed Y
</ActionButton>
</HStack>
<HStack
align="center"
justify="space-between"
p="x2"
borderWidth={1}
borderColor="palette.red600"
>
<Text textStyle="t6Regular">전체 Bleed</Text>
<ActionButton bleed="8px" variant="ghost">
모든 방향
</ActionButton>
</HStack>
</VStack>
);
}
Lynx ActionButton은 React ActionButton과 다음 차이가 있습니다.
onClick 대신 bindtap을 사용합니다.
- HTML
<button> 대신 네이티브 <view>와 <text>를 렌더링합니다.
aria-label 대신 accessibility-label을 사용합니다. 문자열 children에서 이름을 만들 수 없는 버튼과 iconOnly 버튼에는 이름을 직접 지정해야 합니다.
- 아이콘 색상은 Lynx
<image>의 tint-color로 적용합니다.
- loading 중에는 원래 버튼 너비를 유지하면서 탭을 막습니다.
- bleed 값은 px 길이,
0, "safeArea"만 받습니다. SEED 토큰과 "asPadding"은 inline style의 calc() 안에서 CSS 변수를 적용할 수 없어 지원하지 않습니다.
현재 다음 스타일 사용자 지정을 지원하지 않습니다.
| 기능 | 웹 대응 | 설명 |
|---|
color | StyleProps | CSS variable 동적 주입 제한 |
fontWeight | StyleProps | CSS variable 동적 주입 제한 |