Skip to contents

A modal dialog. input$<inputId> is the open state (logical). Open/close from the server with shad_dialog_open() / shad_dialog_close(), or supply a trigger to open client-side with no round trip.

Usage

shad_dialog(
  inputId,
  ...,
  title = NULL,
  description = NULL,
  footer = NULL,
  trigger = NULL,
  size = NULL,
  show_close = TRUE,
  class = NULL
)

shad_dialog_close_button(label = "Cancel", ...)

Arguments

inputId

Input id.

...

For shad_dialog_close_button(), extra attributes for the <button>.

title, description

Optional header text (auto-wired for a11y).

Optional footer content (e.g. buttons); often includes shad_dialog_close_button().

trigger

Optional tag whose click opens the dialog.

size

Optional CSS max-width for the content (e.g. "40rem").

show_close

If TRUE (default), render the top-right close button.

class

Extra CSS classes.

label

Close-button label.

Value

A dialog tag.

Examples

shad_dialog("edit", trigger = shad_button("Edit"),
            title = "Edit profile", "Body here")
#> <div class="shad-dialog" data-shad="dialog" id="edit">
#>   <button class="shad-btn shad-btn--default shad-dialog__trigger" type="button">Edit</button>
#>   <div class="shad-dialog__overlay shad-anim-overlay" hidden></div>
#>   <div class="shad-dialog__content shad-anim-dialog" hidden>
#>     <button type="button" class="shad-dialog__close" data-shad-dialog-close aria-label="Close"><svg class="shad-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg></button>
#>     <div class="shad-dialog__header">
#>       <div class="shad-dialog__title">Edit profile</div>
#>     </div>
#>     Body here
#>   </div>
#> </div>