Component

Avatar

安装 Installation

npx timkit add avatar --yes --framework react

用法 Usage

import { Avatar } from "@/components/ui/avatar"

className 与 variant、size 可以一起用。字段以 timkit agent inspect avatar --json 的 props 为准。

示例

Examples

一次看一个示例。左侧按名称筛选,预览里可切换源码和框架。

23 / 23

Avatar · Image + fallback · 01

Loading preview...

结构化 API

Structured API

与 UCS schema 对齐的 props、逻辑机与多框架运行时。

Component

avatar

Logic

zag / avatar

Runtime Frameworks

ReactVueWeappHTML

Supported Platforms

WebWeChat Mini Program

Configuration

PropTypeDefaultDescription
logic.provider*
enum (zag | native | none)
zagState and interaction provider used by this component.
logic.machine
string
avatarUnderlying state machine identifier when provider is zag.
platforms*
array
Web, WeChat Mini ProgramPlatforms officially supported by this schema.
frameworks*
array
React, Vue, Weapp, HTMLFramework demos/code currently available in registry files.
dependencies
array
@timui/core, @zag-js/reactRuntime package dependencies required by this registry item.
optionalPeerDependencies
array
-Optional peer dependencies used by this registry item.
registryDependencies
array
use-machineDependent Timkit registry components/hook entries.

Props

PropTypeDefaultDescription
src
string
-The source URL of the avatar image.
alt
string
-The alt text for the avatar image.

Slots

PropTypeDefaultDescription
default
slot
-Default slot content rendered inside the component root.

Parts

PropTypeDefaultDescription
root*
root
-The avatar container
image
part
-The avatar image
fallback
part
-The fallback element
This API reference is generated from `/packages/core` component schemas to keep React/Vue/Weapp docs consistent.

该组件尚无扩展说明文档。

键盘与焦点

Keyboard

跨 React、Vue 与小程序共享的交互与可读名称约定。

  • A failed image is visible as Unavailable.
  • A loading or loaded image has no image status.
  • A shown image hides the fallback from the name.

行为契约

Contract

props、默认值和运行时状态。

  • The avatar image uses alt as its accessible name.
  • An omitted name is Avatar.
  • A failed image shows the fallback.