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

docs / components / layout / card docs / components / layout /

card

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

Keep related content together in a bordered area.

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

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

Usage

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

fn view() -> El<Msg> {
    card("k1", Some("天气"), text("晴,22°", 14.0, Paint::TEXT))
}

API

Functionscard
Propskey, title: Option<&str>, body: El<M>.
Filessrc/widgets/card.rs
Depends onbase
Response to frontsinherits (text inside is nudged and legible)
Recompositionkeyed labels recompose when their text changes

Keyboard and accessibility

Statesnone of its own.
Keys and messagesnone; make it pressable with .on_press(m).

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).

Recipes: A page change with a shared part