Components / ShortcutSheet

ShortcutSheet

Dialog listing the keys of a screen, in groups.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn shortcut_sheet() -> impl View {
    let open = State::new(false);
    let show = open.clone();
    VStack::new((
        Button::new("Show shortcuts")
            .style(ButtonStyle::Secondary)
            .icon(IconName::Keyboard)
            .on_click(move || show.set(true)),
        ShortcutSheet::new(open.binding())
            .group("Navigate", [("←", "Previous photo"), ("→", "Next photo")])
            .group("Rate", [("1–5", "Give a score"), ("0", "Take it away")]),
    ))
}

Open in the playground, with every example →

Full API of ShortcutSheet →