データ表示

Avatar

利用者やモノを表す小さな丸い画像。写真がないときは頭文字で代用でき、オンライン中などを示す小さな点も付けられます。

ReactVueWeb Components
Storybook で見る

プレイグラウンド

使用例

<Avatar name="Ada Lovelace" src="/ada.jpg" status="success" statusLabel="online" />
<Avatar name="Grace Hopper" /> // initials "GH"

設定できる項目

名前 既定値 説明
src string Image URL. When set, shows the photo; otherwise initials/children render.
name string Display name — provides the accessible label and derives the initials.
alt string Alternative accessible name when `name` is not the photo subject.
size AvatarSize md Size token. @default 'md'
square boolean false Rounded-square instead of a circle. @default false
status AvatarStatus Presence dot.
statusLabel string Text describing the status dot, so the meaning is not color-only.
imgProps ImgHTMLAttributes<HTMLImageElement> Extra props forwarded to the inner `<img>`.
children ReactNode

アクセシビリティ

  • 文字と背景の明るさの差をしっかり取り、読みやすくしています。ライトでもダークでも、見やすさの国際基準 WCAG の最高ランク AAA(明るさの差が 7:1 以上)を満たします。
  • マウスがなくても、キーボードだけですべての操作ができます。
  • いまどこを操作しているかを示す枠(フォーカスの囲み)が、常にはっきり見えます。
  • 利用者が「画面の動きを減らす」設定にしているときは、過剰なアニメーションを止めます。

どのコンポーネントも、だれにとっても使いやすいように、見やすさの国際基準 WCAG の最高ランク AAA(WCAG 2.1 AAA)を満たすよう作っています。