Learn R Programming

rewind (version 0.3.0)

rewind_buttons: Undo and redo buttons

Description

These two buttons connect to the history of the session. They become enabled and disabled as the history permits. You thus do not have to write an observer on the server.

Usage

rewind_buttons(
  undo_label = "Undo",
  redo_label = "Redo",
  class = NULL,
  button_class = NULL
)

Value

A htmltools::tagList().

Arguments

undo_label, redo_label

The button labels. Use NULL for a button with an icon only. The function then sets the accessible name (aria-label) to "Undo" or "Redo". A screen reader can thus announce the button correctly when it has no text.

class

More CSS classes for the container element.

button_class

More CSS classes for the two buttons. Use it for a Bootstrap variant such as "btn-primary" or "btn-outline-secondary", and for a size such as "btn-sm".

Appearance

The buttons carry btn btn-default, so a Bootstrap theme applies to them without any work. Use button_class to give them a different Bootstrap variant, size or shape:

rewind_buttons(button_class = "btn-primary")
rewind_buttons(button_class = "btn-outline-secondary btn-sm")

A variant that you add wins over btn-default, so the buttons take the colours of the theme of your application. bslib::bs_theme() decides what those colours are. rewind thus has no colours of its own to keep in agreement with your application.

Examples

Run this code
rewind_buttons()
rewind_buttons(undo_label = NULL, redo_label = NULL)
rewind_buttons(button_class = "btn-outline-primary btn-sm")

Run the code above in your browser using DataLab