--- 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는 프로필 이미지 또는 대체 텍스트를 표시합니다. *** title: 'Avatar' site\_name: 'Avatar - Vapor Core' description: 'Avatar는 프로필 이미지 또는 대체 텍스트를 표시합니다.' ------------------------------------------------ ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/default-avatar.tsx", "codeblock": true } ``` ## Property *** ### Size 크기를 지정합니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/avatar-size.tsx", "codeblock": true } ``` ### Shape 모양을 지정합니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/avatar-shape.tsx", "codeblock": true } ``` ## Examples *** ### Composition Pattern 하위 컴포넌트를 조합하여 이미지와 대체 콘텐츠를 커스터마이징합니다. ```json doc-gen:file { "file": "./src/components/demo/examples/avatar/flexible.tsx", "codeblock": true } ``` ### Fallback Only 이미지 없이 대체 콘텐츠만 표시합니다. `delay` prop으로 대체 콘텐츠의 표시 지연 시간을 설정합니다. ```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` | - | 프로필 이미지 URL | | **alt** | `string` | - | 대체 텍스트 | | `delay` | `number`, `undefined` | - | Fallback 표시 지연 시간(ms) | **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. |