Creates a title bar for a Shiny app or Shiny Gadget. Intended to be used with
miniPage()
. Title bars contain a title, and optionally, a
miniTitleBarButton
on the left and/or right sides.
miniTitleBar(title, left = NULL, right = NULL)
gadgetTitleBar(
title,
left = miniTitleBarCancelButton(),
right = miniTitleBarButton("done", "Done", primary = TRUE)
)
miniTitleBarButton(inputId, label, primary = FALSE)
miniTitleBarCancelButton(inputId = "cancel", label = "Cancel", primary = FALSE)
The title of the gadget. If this needs to be dynamic, pass
shiny::textOutput()
with inline = TRUE
.
The miniTitleBarButton
to put on the left, or NULL
for none.
The miniTitleBarButton
to put on the right, or
NULL
for none.
The input
slot that will be used to access the button.
The text label to display on the button.
If TRUE
, render the button in a bold color to indicate
that it is the primary action of the gadget.
gadgetTitleBar
is a miniTitleBar
with different
defaults: a Cancel button on the left and a Done button on the right. By
default, shiny::runGadget()
will handle the Cancel button by
closing the gadget and raising an error, but the Done
button must be
handled by the gadget author using observeEvent(input$done, {...})
.
miniTitleBarCancelButton
is like miniTitleBarButton
,
but the user can also invoke it by hitting the Escape key.
For more information, see the Designing Gadget UI article on shiny.rstudio.com.
miniTitleBar("My App",
left = miniTitleBarButton("prev", "Previous"),
right = miniTitleBarButton("next", "Next")
)
#> <div class="gadget-title">
#> <h1>My App</h1>
#> <button class="btn btn-default btn-sm action-button pull-left" id="prev" type="button">Previous</button>
#> <button class="btn btn-default btn-sm action-button pull-right" id="next" type="button">Next</button>
#> </div>