Add a toggle to the shiny application that triggers all Fomantic UI elements to become "inverted"

darkmode_toggle(label = "Dark Mode", ..., checked = FALSE)

Arguments

label

Labels to add before and after the toggle. By default "Dark Mode" will appear after the toggle

...

Tag attributes (named arguments) and children (unnamed arguments)

checked

Should the application start off in dark mode?

Value

A shiny.tag that will provide a toggle style checkbox in the UI of a shiny application.

Details

To prevent elements from becoming inverted/removing their inverted state, include keep-inverted-state to maintain them in either standard or inverted.

Examples

if (interactive()) {
  library(shiny)
  library(shiny.semantic)
  ui <- semanticPage(
    extendShinySemantic(),
    fui_el$grid(
      fui_el$row(
        class = "two column",
        fui_el$column(
          fui_el$segment(
            class = "purple",
            darkmode_toggle()
          )
        ),
        fui_el$column(
          fui_el$segment(
            class = "red keep-inverted-state"
          )
        )
      )
    ),
    fui_el$cards(
      class = "two",
      fui_el$card(),
      fui_el$card()
    )
  )

  server <- function(input, output, session) {}

  shiny::shinyApp(ui, server)
}