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

docs / components / display / image docs / components / display /

image

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

Show a picture at its own aspect ratio.

A loosened picture turns into marks; under the pointer it loosens nearby.

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 image --to ../my-app

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

Usage

rust
use amenui::widgets::{image};

fn view() -> El<Msg> {
    image("im1", amenui::pictures::SKY, 0.6, 0, Some("天空"))
}

API

Functionsimage
Propskey, id (picture id), ratio (height / width), slot (Markr set for its marks), caption.
Filessrc/widgets/image.rs
Depends onbase
Response to frontsloosen (decoration)
Recompositionkeyed labels recompose when their text changes

Keyboard and accessibility

Statesrest; loosens into its marks under fronts and the lens.
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).