Avatar
Named image or fallback initials for a person.
- ブラウザー
- Chrome 123+Firefox 121+Safari 17.5+
- ティア
- 0
- 圧縮後のサイズ
- 293 B
- 強制レイアウトの上限
- 0 ms
- axe の上限
- 0
- SSR 対応
- はい
- 公開された契約
- テストハーネス
プレイグラウンド
Avatar
Ada Lovelace
使用例
Sizes
The root exposes its size through data-size.
Ada Lovelace
import { Avatar } from "@gunkin/uiify";
export default function Example() {
return (
<>
<Avatar aria-hidden="true" name="Ada Lovelace" fallback="AL" size="sm" />
<Avatar aria-hidden="true" name="Ada Lovelace" fallback="AL" size="md" />
<Avatar aria-hidden="true" name="Ada Lovelace" fallback="AL" size="lg" />
<span>Ada Lovelace</span>
</>
);
}API
Avatar
| Prop | 型 | 既定値 | 説明 |
|---|---|---|---|
name* | string | — | Accessible name for the person represented by the avatar. |
fallback* | string | — | Text shown when src is omitted; provide meaningful initials or a short name. |
src | string | — | Image URL; the image is rendered only when supplied. |
size | "sm" | "md" | "lg" | — | Visual scale written to data-size; omitted when unset. |
className | string | — | ルート要素に適用するクラス。 |
style | CSSProperties | — | Native root styles. |
ref | Ref<HTMLElement> | — | Ref forwarded to the rendered root element. |
render | ReactElement | ((props, state) => ReactElement) | — | 動作とアクセシビリティの接続を維持したまま、描画する要素を置き換えます。 |
キーボード
| キー | 操作 |
|---|
アクセシビリティ
The root is named as an image and the fallback is hidden from assistive technology. Keep a visible name beside decorative avatars and set aria-hidden when that text already names the person. A supplied src renders an image; image-load failures do not trigger a replacement fallback.
スタイリングのフック
data-uiify-avatardata-partdata-size