--- version: 1.0.0-beta.6 --- # Avatar URL: /docs/components/avatar Source: https://raw.githubusercontent.com/goorm-dev/vapor-ui/refs/heads/main/apps/website/content/docs/components/avatar.mdx Avatar는 사용자가 설정한 프로필 이미지 혹은 텍스트를 UI상에 나타냅니다. *** title: 'Avatar' site\_name: 'Avatar - Vapor Core' description: 'Avatar는 사용자가 설정한 프로필 이미지 혹은 텍스트를 UI상에 나타냅니다.' ----------------------------------------------------------- ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/default-avatar.tsx", "codeblock": true } ``` ## Property *** ### Size Avatar의 크기를 설정합니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/avatar-size.tsx", "codeblock": true } ``` ### Shape Avatar의 모양을 설정합니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/avatar-shape.tsx", "codeblock": true } ``` ## Examples *** ### Composition Pattern Avatar 컴포넌트의 다양한 구성 패턴입니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/flexible.tsx", "codeblock": true } ``` ### Fallback Only 이미지 없이 대체 텍스트만 표시합니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/avatar-fallback-only.tsx", "codeblock": true } ``` ## Props Table *** ### Avatar.Root | Prop | Type | Default | Description | | ----------- | --------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `className` | `string`, `((state: Avatar.Root.State) => string)`, `undefined` | - | CSS class applied to the element, or a function that
returns a class based on the component’s state. | | `render` | `((props: HTMLProps, state: Avatar.Root.State) => ReactElement)`, `ReactElement`, `undefined` | - | Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a `ReactElement` or a function that returns the element to render. | | `src` | `string`, `undefined` | - | | | **alt** | `string` | - | | | `delay` | `number`, `undefined` | - | | **Variants** | Variant | Values | Default | | ------- | ---------------------- | -------- | | `size` | `sm`, `md`, `lg`, `xl` | `md` | | `shape` | `square`, `circle` | `square` | #### Avatar.ImagePrimitive | Prop | Type | Default | Description | | ----------------------- | ------------------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `className` | `string`, `((state: Avatar.ImagePrimitive.State) => string)`, `undefined` | - | CSS class applied to the element, or a function that
returns a class based on the component’s state. | | `render` | `((props: HTMLProps, state: Avatar.ImagePrimitive.State) => ReactElement)`, `ReactElement`, `undefined` | - | Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a `ReactElement` or a function that returns the element to render. | | `onLoadingStatusChange` | `((status: ImageLoadingStatus) => void)`, `undefined` | - | Callback fired when the loading status changes. | #### Avatar.FallbackPrimitive | Prop | Type | Default | Description | | ----------- | ---------------------------------------------------------------------------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `className` | `string`, `((state: Avatar.FallbackPrimitive.State) => string)`, `undefined` | - | CSS class applied to the element, or a function that
returns a class based on the component’s state. | | `render` | `((props: HTMLProps, state: Avatar.FallbackPrimitive.State) => ReactElement)`, `ReactElement`, `undefined` | - | Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.

Accepts a `ReactElement` or a function that returns the element to render. |