Skip to contents

Overlays open and close entirely client-side, so every trigger on this page works – click the buttons and try the menus. Each overlay also has an inputId so you can open it from the server with shad_dialog_open() / shad_sheet_open() / etc., and read menu selections with input$id. The Overlays & the server guide covers the reactive half.

Dialog

A modal centred over a dimming backdrop. Supply a trigger to open it from the UI; the content portals to <body> on open.

Code
shad_dialog("demo_dialog", trigger = shad_button("Edit profile"), title = "Edit profile", description = "Make changes to your profile here. Click save when done.", shad_input("d_name", label = "Name", value = "Ada Lovelace"), shad_input("d_user", label = "Username", value = "@ada"), footer = shad_dialog_close_button("Save changes"))

Sheet & drawer

A shad_sheet() slides in from an edge (side); a shad_drawer() rises from the bottom with a drag handle. Both are ideal for secondary forms and detail panes.

Code
shad_sheet("demo_sheet", side = "right", trigger = shad_button("Open sheet", variant = "outline"), title = "Notifications", description = "You have 3 unread messages.", shad_p("Sheet body content goes here."))
shad_drawer("demo_drawer", trigger = shad_button("Open drawer", variant = "outline"), title = "Move goal", description = "Set your daily activity target.", shad_p("Drawer body content goes here."))

Popover

A small floating panel anchored to its trigger – good for pickers and quick forms.

Code
shad_popover("demo_popover", trigger = shad_button("Dimensions", variant = "outline"), title = "Dimensions", shad_input("po_w", label = "Width", value = "100%"), shad_input("po_h", label = "Height", value = "25px"))

Tooltip & hover-card

shad_tooltip() shows a terse label on hover/focus; shad_hover_card() reveals a richer panel after a short delay.

Code
shad_tooltip(trigger = shad_button(icon = "info", size = "icon", aria_label = "Info"), content = "Add to library")
shad_hover_card(trigger = shad_button("@shadshiny", variant = "link"), tags$div(style = "max-width:16rem;display:grid;gap:0.35rem", tags$strong("shadshiny"), shad_muted("A framework-free port of shadcn/ui for Shiny.")))

A menu of actions off a trigger. Items carry icons, shortcuts and a destructive flag; read the chosen item with input$id.

Code
shad_dropdown_menu("demo_menu", trigger = shad_button("Open menu", variant = "outline"), shad_menu_label("My account"), shad_menu_separator(), shad_menu_item("profile", "Profile", icon = "circle", shortcut = "⇧⌘P"), shad_menu_item("settings", "Settings", icon = "more-horizontal"), shad_menu_separator(), shad_menu_item("logout", "Log out", destructive = TRUE))

Context menu

Right-click the target zone to open a menu at the cursor.

Right-click here
Code
shad_context_menu("demo_ctx", target = tags$div(style = paste("display:grid;place-items:center;height:8rem;width:100%;", "border:1px dashed var(--shad-border);border-radius:var(--shad-radius-lg);", "color:var(--shad-muted-foreground)"), "Right-click here"), shad_menu_item("back", "Back", shortcut = "⌘["), shad_menu_item("forward", "Forward", shortcut = "⌘]"), shad_menu_separator(), shad_menu_item("reload", "Reload", shortcut = "⌘R"))

An application menu bar – each shad_menubar_menu() opens a dropdown; hovering across the bar moves between them.

Code
shad_menubar("demo_menubar", shad_menubar_menu("File", shad_menu_item("new", "New tab", shortcut = "⌘T"), shad_menu_item("open", "Open…", shortcut = "⌘O"), shad_menu_separator(), shad_menu_item("print", "Print", shortcut = "⌘P")), shad_menubar_menu("Edit", shad_menu_item("undo", "Undo", shortcut = "⌘Z"), shad_menu_item("redo", "Redo", shortcut = "⇧⌘Z")), shad_menubar_menu("View", shad_menu_item("zoom_in", "Zoom in"), shad_menu_item("zoom_out", "Zoom out")))

Dialogs built in the server

Everything above declares its overlay in the UI. When the content depends on what just happened – the row that was clicked, the upload that failed – build the dialog in the server instead and show it, the way shiny::showModal() works:

observeEvent(input$delete, {
  shad_show_dialog(shad_dialog(
    "confirm",
    title = paste("Delete", input$project, "?"),
    description = "This cannot be undone.",
    footer = tagList(
      shad_dialog_close_button(),
      shad_button(inputId = "confirm_go", "Delete", variant = "destructive")
    )
  ))
})

It is appended to <body>, opens itself, and by default removes itself once it closes – nothing to clean up and no ids left behind. Inputs inside it are live while it is open, so read them in the observer; pass transient = FALSE to keep the overlay (and its values) around for shad_dialog_open(). shad_show_dialog() also takes shad_alert_dialog(), shad_sheet() and shad_drawer(), and shad_remove_dialog() closes one from the server.

Command palette

shad_command() is a searchable action list. Inline it (below) or use shad_command_palette() for the ⌘K spotlight overlay – same component, items supplied as data:

shad_command_palette("palette", items = list(
  "Go to"   = c(Dashboard = "dashboard", Reports = "reports"),
  "Actions" = list(list(value = "new", label = "New report", shortcut = "N"))
))

# a trigger for people who don't know the shortcut
shad_command_trigger("palette")

# observe input$palette_event, NOT input$palette: Shiny drops a repeat of the
# same value, so picking "Reports" twice would only fire once
observeEvent(input$palette_event, { ... })

update_shad_command() swaps the items from the server – recent documents, search hits, commands gated on the signed-in user.

Inline, the same component looks like this. Type to filter.

No results found.
Suggestions
Settings
Code
tags$div(style = "max-width:26rem;width:100%", shad_command("demo_cmd", placeholder = "Type a command or search…", shad_command_group("Suggestions", shad_command_item("cal", "Calendar", icon = "calendar"), shad_command_item("search", "Search", icon = "search"), shad_command_item("mail", "Send mail", icon = "mail")), shad_command_group("Settings", shad_command_item("profile", "Profile", shortcut = "⌘P"), shad_command_item("billing", "Billing", shortcut = "⌘B"))))