AlertDialog
確認操作に特化し、背景クリックで閉じる既定動作をより厳格にしたダイアログです。
デモを読み込み中…
let dialog = Dialog::alert("quit", open);
dialog.root().child(dialog.title_with(text("Quit without saving?")))#インポート
quickgui から Dialog をインポートします。
use quickgui::*;#使い方
let dialog = Dialog::alert("quit", open);
dialog.root().child(dialog.title_with(text("Quit without saving?")))#構成
Dialog::rootDialog::triggerDialog::portalDialog::backdropDialog::viewportDialog::popupDialog::titleDialog::descriptionDialog::close
#API リファレンス
項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。
Dialog
ソースを見るpub fn alert(id: impl Into<ElementId>, open: bool) -> SelfDeclare a consequential alert dialog. Escape remains enabled, while a backdrop press is blocked without dismissing by default.
newpub fn new(id: impl Into<ElementId>, open: bool) -> Self—
with_kindpub fn with_kind(id: impl Into<ElementId>, open: bool, kind: DialogKind) -> Self—
Configures with kind for this part.
pub fn with_kind(id: impl Into<ElementId>, open: bool, kind: DialogKind) -> Selfソースを見るis_openpub const fn is_open(self) -> bool—
kindpub const fn kind(self) -> DialogKind—
initial_focuspub fn initial_focus(mut self, focus: impl Into<ElementId>) -> Self—
Prefer one mounted descendant when this dialog opens. Without an explicit target, the focus trap chooses its first enabled Tab stop and falls back to the popover root when no interactive descendant exists.
pub fn initial_focus(mut self, focus: impl Into<ElementId>) -> Selfソースを見るrestore_focus_topub fn restore_focus_to(mut self, focus: impl Into<ElementId>) -> Self—
Restore focus to one stable control after every dismissal path.
pub fn restore_focus_to(mut self, focus: impl Into<ElementId>) -> Selfソースを見るdismiss_on_escapepub const fn dismiss_on_escape(mut self, dismiss: bool) -> Self—
Configures dismiss on escape for this part.
pub const fn dismiss_on_escape(mut self, dismiss: bool) -> Selfソースを見るdismiss_on_backdroppub const fn dismiss_on_backdrop(mut self, dismiss: bool) -> Self—
Configures dismiss on backdrop for this part.
pub const fn dismiss_on_backdrop(mut self, dismiss: bool) -> Selfソースを見るroot_idpub fn root_id(self) -> ElementId—
backdrop_idpub fn backdrop_id(self) -> ElementId—
popover_idpub fn popover_id(self) -> ElementId—
title_idpub fn title_id(self) -> ElementId—
description_idpub fn description_id(self) -> ElementId—
close_idpub fn close_id(self) -> ElementId—
viewport_idpub fn viewport_id(self) -> ElementId—
Stable identity of the scrolling viewport between the backdrop and the popup.
pub fn viewport_id(self) -> ElementIdソースを見るpopover_focuspub fn popover_focus(self) -> FocusHandle—
focus_initialpub fn focus_initial(self, cx: &mut EventContext)—
Request the declared initial focus in the same event that mounts the dialog.
pub fn focus_initial(self, cx: &mut EventContext)ソースを見るfocus_restorepub fn focus_restore(self, cx: &mut EventContext)—
Restore the declared focus after an explicit close action. Escape and backdrop dismissal already use the same retained target automatically.
pub fn focus_restore(self, cx: &mut EventContext)ソースを見るDialog::trigger_with
ソースを見るpub fn trigger_with(self, id: impl Into<ElementId>, trigger: Element) -> ElementDecorate an application-owned trigger without adding appearance.
Dialog::trigger
ソースを見るpub fn trigger(self, id: impl Into<ElementId>) -> ElementCreate the unstyled trigger part. Use [`Self::trigger_with`] to supply an existing element.
Dialog::root_with
ソースを見るpub fn root_with(self, root: Element) -> ElementDecorate the full-window portal and active modal focus boundary.
Dialog::root
ソースを見るpub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Dialog::backdrop_with
ソースを見るpub fn backdrop_with(self, backdrop: Element) -> ElementDecorate the caller-owned visual backdrop.
Dialog::backdrop
ソースを見るpub fn backdrop(self) -> ElementCreate the unstyled backdrop part. Use [`Self::backdrop_with`] to supply an existing element.
Dialog::popup_with
ソースを見るpub fn popup_with(self, popover: Element) -> ElementDecorate the caller-owned modal popover. The popover is a negative-Tab-index focus fallback. Enabled descendant Tab stops are chosen first when the enclosing trap mounts. Title and description relationships project only when the corresponding parts are mounted, so incomplete compositions never emit dangling native node references.
Dialog::popup
ソースを見るpub fn popup(self) -> ElementCreate the unstyled popup part. Use [`Self::popup_with`] to supply an existing element.
Dialog::viewport_with
ソースを見るpub fn viewport_with(self, viewport: Element) -> ElementDecorate the caller-owned scrolling viewport the popup sits inside, Base UI's Viewport. A dialog taller than the window must scroll as one surface rather than clipping its own content, and the scroll must live outside the popup so the popup keeps its own padding and shadow. QuickGUI supplies the stable identity and the scroll container; size, alignment, and padding stay application-owned.
Dialog::viewport
ソースを見るpub fn viewport(self) -> ElementCreate the unstyled viewport part. Use [`Self::viewport_with`] to supply an existing element.
Dialog::title_with
ソースを見るpub fn title_with(self, title: Element) -> ElementAssign the stable visible label target used by the popover.
Dialog::title
ソースを見るpub fn title(self) -> ElementCreate the unstyled title part. Use [`Self::title_with`] to supply an existing element.
Dialog::description_with
ソースを見るpub fn description_with(self, description: Element) -> ElementAssign the stable visible description target used by the popover.
Dialog::description
ソースを見るpub fn description(self) -> ElementCreate the unstyled description part. Use [`Self::description_with`] to supply an existing element.
Dialog::close_with
ソースを見るpub fn close_with(self, label: impl Into<std::sync::Arc<str>>, close: Element) -> ElementDecorate a caller-owned close control with button behavior and no visual defaults.
Dialog::close
ソースを見るpub fn close(self, label: impl Into<std::sync::Arc<str>>) -> ElementCreate the unstyled close part. Use [`Self::close_with`] to supply an existing element.
