Link (링크)
사용자가 웹 페이지나 애플리케이션 안에서 다른 페이지나 리소스로 이동할 수 있게 해주는 컴포넌트예요. 네이티브 HTML <a> 요소를 지원하고, 링크를 비활성화하거나 커스텀 요소 타입으로 바꿔 사용할 수도 있어요.
출처: 문서
본문
Import (불러오기)
import { Link } from "@kobalte/core/link";
// or
import { Root } from "@kobalte/core/link";
// or (deprecated)
import { Link } from "@kobalte/core";
Features (기능)
- 네이티브 HTML
<a>요소를 지원해요. - WAI ARIA Link 디자인 패턴을 통해 커스텀 요소 타입을 지원해요.
- 비활성화된 링크(disabled link)를 지원해요.
Anatomy (구조)
링크는 다음의 부분으로 이루어져요:
- Link: 링크의 루트 컨테이너예요.
<Link />
Example (예제)
기본 예제를 통해 링크의 구조와 스타일링 방식을 확인해 보세요. 인터랙티브한 미리보기는 출처 문서에서 직접 확인할 수 있어요.
Usage (사용법)
Disabled state (비활성화 상태)
disabled prop을 사용하면 링크를 비활성화하면서도 스크린 리더가 접근할 수 있도록 유지할 수 있어요.
<Link href="https://kobalte.dev" disabled>
Kobalte
</Link>
API Reference (API 참조)
Link
Link은 @kobalte/core/link의 Root 임포트(그리고 더 이상 사용되지 않는 Link.Root)와 동일해요.
| Prop | Description |
|---|---|
| disabled | boolean Whether the link is disabled. Native navigation will be disabled, and the link will be exposed as disabled to assistive technology. |
| Data attribute | Description |
|---|---|
| data-disabled | Present when the link is disabled. |
Rendered elements (렌더링되는 요소)
| Component | Default rendered element |
|---|---|
Link |
a |
Accessibility (접근성)
Keyboard Interactions (키보드 상호작용)
| Key | Description |
|---|---|
| Enter | Activates the link. |
더 알아보기 (Learn more)
- Link 컴포넌트 소스 — GitHub 저장소
- WAI ARIA Link 패턴 — 접근성 가이드라인
- Kobalte 시작하기 — 프로젝트 설정