#gui-widgets #widgets #graphics

iced_dialog

A custom dialog widget for iced

2 unstable releases

Uses new Rust 2024

0.14.0 Dec 8, 2025
0.13.0 Jul 4, 2025

#737 in GUI

Download history 18/week @ 2026-01-01 23/week @ 2026-01-15 38/week @ 2026-01-22 50/week @ 2026-01-29 26/week @ 2026-02-05

137 downloads per month
Used in 2 crates

MIT license

34KB
441 lines

iced_dialog

builds.sr.ht status   docs

Custom dialog for iced

It's mostly the dialog from @frgp42's Fluent Iced Gallery, but made into a "widget"

Example

use iced::{
    Element, Task,
    widget::{button, center, column, text},
};
use iced_dialog::dialog;

#[derive(Default)]
struct State {
    is_open: bool,
    action_text: &'static str,
}

#[derive(Debug, Clone)]
enum Message {
    OpenDialog,
    Saved,
    Cancelled,
}

fn main() -> iced::Result {
    iced::run(State::update, State::view)
}

impl State {
    fn update(&mut self, message: Message) -> Task<Message> {
        match message {
            Message::OpenDialog => self.is_open = true,
            Message::Saved => {
                self.action_text = "User saved their work";
                self.is_open = false;
            }
            Message::Cancelled => {
                self.action_text = "User cancelled the dialog";
                self.is_open = false;
            }
        }
        Task::none()
    }

    fn view(&self) -> Element<'_, Message> {
        let base = center(
            column![
                text(self.action_text),
                button("Open Dialog").on_press(Message::OpenDialog)
            ]
            .spacing(14.0),
        );

        let dialog_content = text("Do you want to save?");

        dialog(self.is_open, base, dialog_content)
            .title("Save")
            .push_button(iced_dialog::button("Save work", Message::Saved))
            .push_button(iced_dialog::button("Cancel", Message::Cancelled))
            .width(350)
            .height(234)
            .on_press(Message::Cancelled)
            .into()
    }
}

You can also run the above example:

cargo run -p example

Dependencies

~26MB
~527K SLoC