amenui
en·中 github ↗ v0.0.1
01docs 02components 03lab 04works
en·中github ↗
×

docs / components / display / avatar docs / components / display /

avatar

04.14
On this page ▾
  1. Installation
  2. Usage
  3. API
  4. Keyboard and accessibility

Stands for a person by their initials (no pictures).

drawn by amenuiopen ↗

Installation

Components are distributed as source. Copy it and what it depends on into your project, then change it as you need:

sh
cargo run --release --bin amenui -- add avatar --to ../my-app

Files copied: src/widgets/avatar.rs, src/widgets/mod.rs

Usage

rust
use amenui::widgets::{avatar, initials};

fn view() -> El<Msg> {
    row().gap(8.0).child(avatar("av1", "Lin Mo", 36.0, 0)).child(avatar("av2", "林墨", 36.0, 1)).child(avatar("av3", "Ada", 36.0, 2))
}

API

Functionsavatar, initials
Propskey, name, size, hue (0, 1, 2).
Filessrc/widgets/avatar.rs
Depends onbase
Response to frontsnudge (a control: pushed as one piece by fronts, held and condensing at most to Look::legible_cap)
Recompositionkeyed labels recompose when their text changes

Keyboard and accessibility

Statesnone.
Keys and messagesnone.

On the web every control is mirrored into the page as an element with its role and name, so screen readers and the browser's own focus see it (DESIGN.md §1.14).