import { Button } from 'sud-ui';사용자의 주요 행동을 유도할 때 (예: 제출, 저장, 확인)
폼이나 다이얼로그에서 작업을 완료하거나 취소할 때
사용자에게 추가 정보나 다음 단계로 이동할 수 있는 옵션을 제공할 때
작업의 진행 상태를 표시할 때 (로딩 상태)
사용자의 선택이나 결정을 확인할 때
주요 기능이나 액션에 대한 접근성을 제공할 때
import React, { useState } from "react";
import { Button, Card, Radio } from "sud-ui";
const colorTypeOptions = [
{ label: "default", value: "default" },
{ label: "sub", value: "sub" },
{ label: "primary", value: "primary" },
{ label: "secondary", value: "secondary" },
{ label: "success", value: "success" },
{ label: "warning", value: "warning" },
{ label: "danger", value: "danger" },
{ label: "info", value: "info" },
{ label: "ghost", value: "ghost" },
{ label: "text", value: "text" }
];
export default function Example() {
const [colorType, setColorType] = useState("default");
return (
<div className="flex flex-col gap-[20px] justify-center items-center">
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<div className="flex justify-center">
<Radio.Group
options={colorTypeOptions}
direction="horizontal"
value={colorType}
onChange={setColorType}
/>
</div>
</Card>
<Button colorType={colorType}>{colorType} Button</Button>
</div>
);
}import React, { useState } from "react";
import { Button, Card, Radio } from "sud-ui";
const shapeOptions = [
{ label: "rounded", value: "rounded" },
{ label: "capsule", value: "capsule" },
{ label: "square", value: "square" },
{ label: "circle", value: "circle" }
];
export default function Example() {
const [shape, setShape] = useState("rounded");
return (
<div className="flex flex-col gap-[20px] justify-center items-center">
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<Radio.Group
options={shapeOptions}
direction="horizontal"
value={shape}
onChange={setShape}
/>
</Card>
<Button shape={shape}>{shape} Button</Button>
</div>
);
}import React from "react";
import { Button } from "sud-ui";
export default function Example() {
return <Button disabled>Disable Button</Button>;
}import React from "react";
import { Button } from "sud-ui";
export default function Example() {
return (
<Button
background="linear-gradient(100deg, #0958d9 0%, #69b1ff 100%)"
color="#ffffff"
>
Gradient Button
</Button>
);
}import React, { useState } from "react";
import { Button, Card, Radio } from "sud-ui";
const borderTypeOptions = [
{ label: "solid", value: "solid" },
{ label: "dashed", value: "dashed" },
{ label: "dotted", value: "dotted" },
{ label: "double", value: "double" },
{ label: "groove", value: "groove" },
{ label: "ridge", value: "ridge" },
{ label: "inset", value: "inset" },
{ label: "outset", value: "outset" }
];
export default function Example() {
const [borderType, setBorderType] = useState("solid");
return (
<div className="flex flex-col gap-[20px] justify-center items-center">
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<Radio.Group
options={borderTypeOptions}
direction="horizontal"
value={borderType}
onChange={setBorderType}
/>
</Card>
<Button shadow="none" borderType={borderType} borderWeight={3}>
{borderType} Button
</Button>
</div>
);
}import React, { useState } from "react";
import { Button, Card, Radio, Divider, Input } from "sud-ui";
const loadingTypeOptions = [
{ label: "default", value: "default" },
{ label: "elastic", value: "elastic" },
{ label: "brush", value: "brush" }
];
const loadingPositionOptions = [
{ label: "left", value: "left" },
{ label: "right", value: "right" }
];
export default function Example() {
const [loadingType, setLoadingType] = useState("default");
const [loadingPosition, setLoadingPosition] = useState("right");
const [loadingText, setLoadingText] = useState("Loading...");
return (
<div className="flex flex-col gap-[20px] justify-center items-center">
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<div className="flex flex-col gap-[10px]">
<Radio.Group
options={loadingTypeOptions}
direction="horizontal"
value={loadingType}
onChange={setLoadingType}
/>
<Divider />
<Radio.Group
options={loadingPositionOptions}
direction="horizontal"
value={loadingPosition}
onChange={setLoadingPosition}
/>
<Divider />
<Input
size="sm"
value={loadingText}
onChange={(e) => setLoadingText(e.target.value)}
/>
</div>
</Card>
<Button
loading
loadingType={loadingType}
loadingPosition={loadingPosition}
>
{loadingText}
</Button>
</div>
);
}import React, { useState } from "react";
import { Button, Card, Radio } from "sud-ui";
import { Chat } from "sud-icons";
const iconPositionOptions = [
{ label: "left", value: "left" },
{ label: "right", value: "right" }
];
export default function Example() {
const [iconPosition, setIconPosition] = useState("left");
return (
<div className="flex flex-col gap-[20px] justify-center items-center">
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<Radio.Group
options={iconPositionOptions}
direction="horizontal"
value={iconPosition}
onChange={setIconPosition}
/>
</Card>
<Button icon={<Chat size={16} />} iconPosition={iconPosition}>
Icon Button
</Button>
</div>
);
}import React, { useState } from "react";
import { Button, Card, Radio } from "sud-ui";
const sizeOptions = [
{ label: "sm", value: "sm" },
{ label: "md", value: "md" },
{ label: "lg", value: "lg" }
];
export default function Example() {
const [size, setSize] = useState("md");
return (
<div className="flex flex-col gap-[20px] justify-center items-center">
<Card style={{ width: "100%" }} shadow="none" colorType="sub">
<Radio.Group
options={sizeOptions}
direction="horizontal"
value={size}
onChange={setSize}
/>
</Card>
<Button size={size}>{size} size Button</Button>
</div>
);
}속성 이름 | 설명 | 타입 | 기본값 |
|---|
| type | 네이티브 버튼 타입. 폼 제출 버튼은 submit을 명시해야 합니다. | button | submit | reset | button |
| children | 버튼의 내용 | ReactNode | - |
| colorType | 버튼의 색상 타입 | default | primary | success | warning | danger | info | red | rose | coral | orange | volcano | apricot | yellow | gold | amber | green | lime | mint | blue | sky | cerulean | indigo | cobalt | navy | purple | plum | orchid | forest | sage | warm-gray | cool-gray | neutral | text | ghost | default |
| background | 배경색(palette값 또는 HEX code) | string | - |
| color | 텍스트 색상(palette값 또는 HEX code) | string | - |
| border | 테두리 표시 여부 | boolean | true |
| borderColor | 테두리 색상(palette값 또는 HEX code) | string | - |
| borderType | 테두리 스타일 | solid | dashed | dotted | double | groove | ridge | inset | outset | none | solid |
| borderWeight | 테두리 두께 | number | 1 |
| icon | 버튼에 표시할 아이콘 | ReactNode | - |
| iconPosition | 아이콘의 위치 | left | right | left |
| disabled | 버튼 비활성화 여부 | boolean | false |
| loading | 로딩 상태 표시 여부 | boolean | false |
| loadingText | 로딩 상태일 때 표시할 텍스트 | string | - |
| loadingType | 로딩 스피너의 타입 | default | elastic | brush | default |
| loadingPosition | 로딩 표시 위치 | left | right | right |
| size | 버튼 크기 | sm | md | lg | md |
| shape | 버튼의 모양 | square | circle | rounded | capsule | rounded |
| shadow | 버튼의 그림자 효과 | none | sm | md | lg | sm |
| onClick | 클릭 이벤트 핸들러 (disabled나 loading 상태에서는 실행되지 않음) | (event: React.MouseEvent<HTMLButtonElement>) => void | - |
| className | 추가 클래스명 | string | - |
| style | 추가 스타일 | CSSProperties | {} |
| ariaLabel | ARIA 라벨 (접근성) | string | - |
| ariaPressed | ARIA pressed 상태 (토글 버튼용) | boolean | - |
| ariaExpanded | ARIA expanded 상태 (드롭다운 버튼용) | boolean | - |
| ariaControls | ARIA controls 속성 (제어하는 요소의 ID) | string | - |
| role | 필요한 경우 재정의할 ARIA 역할. 기본값은 네이티브 button 역할입니다. | string | - |