Avatar

A visual representation of a user or entity.

Installation

Install the component package, shared coss-svelte theme, and Bits UI peer.

npm install coss-svelte @coss-svelte/theme bits-ui

Usage

Import the Svelte component exports directly from the package.

import { Avatar, AvatarFallback, AvatarImage } from "coss-svelte";

Anatomy

  • Avatar
  • AvatarFallback
  • AvatarImage

API Reference

Avatar

A visual representation of a user or entity.

PropTypeDefaultDescription
srcstring""Image source for the avatar.
altstring-Accessible text for the avatar image.
fallbackstring""Text shown when the avatar image is unavailable.
children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Avatar.Root.

AvatarFallback

Renders fallback content when primary media is unavailable.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Avatar.Fallback.

AvatarImage

Renders the primary image for the parent component.

children : Snippet<[]>bind:ref : HTMLElement | null

Inherits from Bits UI Avatar.Image.

Implementation Details

Status
Stable
Foundation
bits
Category
Content & Display
Particles
14