diff --git a/crates/story/src/dialog_story.rs b/crates/story/src/dialog_story.rs index 94554c43..ce0bf7f4 100644 --- a/crates/story/src/dialog_story.rs +++ b/crates/story/src/dialog_story.rs @@ -359,7 +359,8 @@ impl Render for DialogStory { .on_click(cx.listener(move |_, _, window, cx| { window.open_dialog(cx, move |dialog, window, cx| { dialog - .h(px(450.)) + .w(px(720.)) + .h(px(600.)) .overlay(dialog_overlay) .overlay_closable(overlay_closable) .title("Dialog with scrollbar") diff --git a/crates/ui/src/dialog.rs b/crates/ui/src/dialog.rs index d215ccad..ff990baf 100644 --- a/crates/ui/src/dialog.rs +++ b/crates/ui/src/dialog.rs @@ -1,7 +1,7 @@ use std::{rc::Rc, time::Duration}; use gpui::{ - Animation, AnimationExt as _, AnyElement, App, Bounds, BoxShadow, ClickEvent, Div, Edges, + Animation, AnimationExt as _, AnyElement, App, Bounds, BoxShadow, ClickEvent, Div, Edges, FocusHandle, Hsla, InteractiveElement, IntoElement, KeyBinding, MouseButton, ParentElement, Pixels, Point, RenderOnce, SharedString, StyleRefinement, Styled, Window, anchored, div, hsla, point, prelude::FluentBuilder, px, relative, @@ -231,6 +231,14 @@ impl Dialog { self } + /// Sets the width of the dialog, defaults to 480px. + /// + /// See also [`Self::width`] + pub fn w(mut self, width: Pixels) -> Self { + self.width = width; + self + } + /// Sets the width of the dialog, defaults to 480px. pub fn width(mut self, width: Pixels) -> Self { self.width = width; @@ -502,7 +510,7 @@ impl RenderOnce for Dialog { .id("contents") .pl(paddings.left) .pr(paddings.right) - .overflow_scrollbar() + .overflow_y_scrollbar() .child(self.content), ), )