Skyline_dialog_v2SourceA Dialog is a layout view that is usually used within a Modal compponent.
Dialogs are created by composing multiple subviews together:
Section.title emphasizes its contents and reserves space for the close button.Section.text wraps the main content and can scroll when the dialog would otherwise overflow.Section.footer is a container for action buttons.Close_button is a special button that gets placed in the header while being ordered last in the DOM.Layout behavior
The Dialog.view itself renders as a block element that sizes to its contents. It is typically used inside a Modal, which makes it an overlay element rendered in the browser top layer and constrained by the viewport.
Example
{%html|
<Skyline.Dialog.view>
<Skyline.Dialog.Section.title>
Dialog with separators
</>
<Skyline.Dialog.Close_button.content ~close:%{Effect.Ignore} />
<Skyline.Dialog.Section.separator />
<Skyline.Dialog.Section.text>
This is the content of a dialog that can be used to display bigger blocks of
content
</>
<Skyline.Dialog.Section.separator />
<Skyline.Dialog.Section.footer>
<Skyline.Button.view ~on_click:%{Effect.Ignore}>
Confirm
</>
<Skyline.Button.view ~on_click:%{Effect.Ignore} ~intent:%{`Secondary}>
Cancel
</>
</>
</>
|}val view :
?test_selector:Bonsai_web.Bonsai.Test_selector.t ->
?size:Skyline_size.t ->
?attrs:Bonsai_web.Vdom.Attr.t list ->
Content.t list ->
Bonsai_web.Vdom.Node.tA dialog view's root.
Container for the dialog layout. You should only provide subviews from this module as children.
?test_selector allows to select the element in tests.?size scales the size of Dialog.* view elements.?attrs allows to add arbitrary attrs to this element. We do not advise attaching style alterations to this element.In Modals
By default a dialog will show up in the document's flow; it will not appear "over" the app in the way most dialogs are designed.
To get a "modal" dialog, use with the Modal.component in Skyline_modal_v2.