mbr/elm-chadcn/1.0.0

ChadCn.Avatar

Provides an avatar component.

The implementation follows the shadcn Base UI structure and Nova defaults.

type Config msg

Describes an avatar and its presentation.

type Model

Holds avatar image loading state.

type Msg

Describes events handled by an avatar.

type Size
= Default
| Small
| Large

Controls avatar dimensions.

Creates avatar image loading state.

new : (Msg -> msg) -> List (Html msg) -> Config msg

Creates a default-sized avatar with caller-owned fallback content.

withAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the avatar root.

withFallbackAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the avatar fallback.

withImage : String -> String -> Config msg -> Config msg

Adds an image with alternative text to the avatar.

withImageAttributes : List (Attribute msg) -> Config msg -> Config msg

Adds native attributes to the avatar image.

withSize : Size -> Config msg -> Config msg

Sets the avatar dimensions.

Applies an avatar image loading event.

view : Model -> Config msg -> Html msg

Renders a configured avatar.