Fusuma

Components / Basics

hover_card

A hover card: a panel that opens by itself under the node called anchor when the pointer has rested on it for half a second, and closes when it leaves the anchor and the card.

How it looks

Drawn by the toolkit from the example below. No page of the gallery uses hover_card yet, so there is nothing to run.

hover_card drawn by Fusuma

A hover card: a panel that opens by itself under the node called anchor when the pointer has rested on it for half a second, and closes when it leaves the anchor and the card. It is not modal. Move it with .side(..) and .after_ms(..).

anchor is a name given with named.

Signature

pub const fn hover_card<C, M>(anchor: fusuma_ui::Id, children: C) -> Special<C, M>

Methods

  • .padding(px: u32) -> Self — Room around the children.
  • .gap(px: u32) -> Self — Room between the children.
  • .width(length: Length) -> Self — The width.
  • .height(length: Length) -> Self — The height.
  • .align(align: CrossAlign) -> Self — How the children line up across the axis.
  • .background(surface: fusuma_ui::Surface) -> Self — The surface it is painted on.
  • .round(round: fusuma_ui::Round) -> Self — How round its corners are.
  • .side(side: fusuma_ui::Side, align: fusuma_ui::Align) -> Self — Which side of its anchor a hover card sits on, and how it lines up with it.
  • .after_ms(ms: u16) -> Self — How long the pointer rests on the anchor before a hover card opens.
  • .on_dismiss(message: M) -> Self — Sends message when a dialog or menu is dismissed (a press outside, Escape).

Example

use fusuma::{Id, button, column, hover_card, named, text};
const AVATAR: Id = Id::new(7);
let view = column((
    named(AVATAR, button("Ada")),
    hover_card(AVATAR, (text("Ada Lovelace"),)),
));
let built = fusuma::doc::built::<(), _>(&view);
assert!(built.texts().contains(&"Ada Lovelace"));

All components · Source