아바타
아바타 (Avatar)
아바타는 이미지, 이니셜, 상태 표시자를 지원하며 사용자를 표시하는 컴포넌트예요. 사용자나 엔티티(저장소, 스페이스)를 나타낼 때 사용한답니다.
출처: 문서
본문
Avatar 컴포넌트
이미지, 이니셜, 상태 표시자를 지원하는 사용자 아바타 표시 컴포넌트예요.
- 키워드: avatar, user, profile, image, picture, photo, presence, status, representation
- 카테고리: images
- 상태: general-availability
예시
import Avatar from '@atlaskit/avatar/avatar';
const Examples = (): React.JSX.Element => (
<>
<Avatar src="https://example.com/avatar.jpg" name="John Doe" />
<Avatar name="Jane Smith" appearance="hexagon" size="large" status="locked" />
<Avatar
name="Bob Wilson"
appearance="square"
size="small"
presence="online"
status="approved"
/>
</>
);
export default Examples;
Props
| Prop | Type | Description |
|---|---|---|
appearance |
"circle" | "square" | "hexagon" |
Indicates the shape of the avatar |
aria-controls |
string |
Identifies the popup element that the trigger controls |
aria-expanded |
boolean |
Announces to assistive technology whether the popup is currently open or closed |
aria-haspopup |
boolean | "dialog" |
Informs assistive technology that this element triggers a popup |
as |
keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement>> |
Replace the wrapping element |
borderColor |
string |
Used to override the default border color around the avatar body |
children |
string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<ReactNode> | React.ReactPortal |
Supply a custom avatar component instead of the default |
href |
string |
Provides a url for avatars being used as a link |
imgLoading |
"lazy" | "eager" |
Defines the loading behaviour of the avatar image |
isDisabled |
boolean |
Change the style to indicate the avatar is disabled |
label |
string |
Used to provide custom content to screen readers |
name |
string |
Provides alt text for the avatar image |
onClick |
(event: MouseEvent<Element, globalThis.MouseEvent>, analyticsEvent?: UIAnalyticsEvent) => void |
Handler to be called on click |
presence |
(string & {}) | Presence | Omit<ReactNode, string> |
Indicates a user's online status by showing a small icon on the avatar |
size |
"small" | "xxsmall" | "UNSAFE_xsmall" | "medium" | "large" | "xlarge" | "xxlarge" |
|
src |
string |
A url to load an image from (this can also be a base64 encoded image) |
stackIndex |
number |
The index of where this avatar is in the group stack |
status |
(string & {}) | Omit<ReactNode, string> | Status |
Indicates contextual information by showing a small icon on the avatar |
tabIndex |
number |
Assign specific tabIndex order to the underlying node |
target |
"_blank" | "_self" | "_top" | "_parent" |
Pass target down to the anchor, if href is provided |
사용 지침
- 사용자나 엔티티(저장소, 스페이스)에 사용해요. 원(circle) = 사람; 육각형(hexagon) = 에이전트/AI; 사각형(square) = 프로젝트/저장소/스페이스
- 가용성은 presence로, 승인/권한 상태는 status로 표시해요
- 같은 맥락 안에서는 일관된 크기를 사용해요
- 새로운 16px 아바타에는
xxsmall을 사용해요. 현재 메이저 버전에서 레거시xsmall도 16px이며 Avatar codemod와 함께xxsmall로 마이그레이션해야 해요.xsmall은 향후 메이저 버전에서 20px이 될 거예요 - 16px 또는 20px 크기는 AvatarGroup과 함께 사용하지 마세요
- 아바타를 논리적인 그룹으로 배치해요 (예: 팀 멤버)
- 실시간 상태에만 presence 표시자를 아껴서 사용해요
- 이미지 로드에 실패하면 이니셜로 대체하도록 해요
- 접근성을 위해 항상 의미 있는 이름을 제공해요
- 스크린 리더를 위한 대체 텍스트를 포함하려면
nameprop을 사용해요 - 장식용 이미지에는
nameprop을 생략하거나 비워 두어 보조 기술이 무시하도록 해요 - 비상호작용이거나 비활성화된 아바타에는 툴팁을 사용하지 마세요. 툴팁은 키보드 사용자와 스크린 리더에 동작하지 않아요
콘텐츠 지침
- 인지도를 높이기 위해 가능하면 전체 이름을 사용해요
- 회사/프로젝트에는 설명적인 이름을 사용해요
- 'User'나 'Admin' 같은 일반적인 용어는 피해요
- 앱 전체에서 일관된 명명 규칙을 사용해요
- 이름을 간결하지만 의미 있게 유지해요