Avatar

Description

Create a small round image with an initials fallback.

Usage

bc_avatar(
  ...,
  src = NULL,
  alt = NULL,
  fallback = NULL,
  size = "default",
  badge = NULL
)

bc_avatar_group(..., count = NULL)

bc_avatar_badge(...)

Arguments

Argument Description
... Tag attributes and content.
src String. The image URL, or NULL for initials only.
alt String. Alt text for the image.
fallback String. Initials or short text shown when the image is missing.
size String. One of default, sm, lg.
badge A bc_avatar_badge(), or NULL.
count Text or an icon shown after the last avatar, or NULL.

Value

An htmltools tag.

Examples

bc_avatar(src = "https://github.com/shadcn.png", alt = "@shadcn", fallback = "CN")
@shadcnCN

bc_avatar(fallback = "JP", size = "lg")
JP

bc_avatar_group(
  bc_avatar(fallback = "CN"),
  bc_avatar(fallback = "LR"),
  count = "+3"
)
CN LR +3

bc_avatar(
  fallback = "CN",
  badge = bc_avatar_badge(class = "bg-green-600")
)
CN