Button (버튼)
버튼은 사용자가 액션이나 이벤트를 트리거하도록 하는 컴포넌트예요. 예를 들어 폼 제출, 대화상자 열기, 액션 취소, 삭제 작업 수행 등을 버튼으로 실행할 수 있어요.
출처: 문서
본문
Import (불러오기)
import { Button } from "@kobalte/core/button";
// or
import { Root } from "@kobalte/core/button";
// or (deprecated)
import { Button } from "@kobalte/core";
Features (기능)
- 네이티브 HTML
<button>요소를 지원해요. - WAI ARIA Button 디자인 패턴을 통해
<a>및 커스텀 요소 타입을 지원해요. - Space와 Enter 키에 대한 키보드 이벤트를 지원해요.
Anatomy (구조)
버튼은 다음의 부분으로 이루어져요:
- Button: 버튼의 루트 컨테이너예요.
<Button />
Example (예제)
기본 예제를 통해 버튼의 구조와 스타일링 방식을 확인해 보세요. 인터랙티브한 미리보기는 출처 문서에서 직접 확인할 수 있어요.
API Reference (API 참조)
Button
Button은 @kobalte/core/button의 Root 임포트(그리고 더 이상 사용되지 않는 Button.Root)와 동일해요.
| Prop | Description |
|---|---|
| disabled | boolean Whether the button is disabled. |
| Data attribute | Description |
|---|---|
| data-disabled | Present when the button is disabled. |
Rendered elements (렌더링되는 요소)
| Component | Default rendered element |
|---|---|
Button |
button |
Accessibility (접근성)
Keyboard Interactions (키보드 상호작용)
| Key | Description |
|---|---|
| Space | Activates the button. |
| Enter | Activates the button. |
더 알아보기 (Learn more)
- Kobalte 시작하기 — 프로젝트 설정
- WAI ARIA Button 패턴 — 접근성 가이드라인