Skip to content

Conversation

@elnelson575
Copy link
Contributor

@elnelson575 elnelson575 commented Nov 25, 2025

Fixes #1257

Add input switch to toolbar with very minor adjustments to ensure that it sits nicely next to toolbar input buttons

NOTE: This PR includes the toolbar input button PR changes because they affect some spacing/header portions as well and to make sure the buttons sit nicely together. When this is merged, it will clean up the diff.

Screenshot 2025-11-25 at 12 43 44 PM
library(shiny)
library(bslib)

ui <- page_fillable(
  tags$head(
    tags$link(rel = "stylesheet", type = "text/css", href = "styles.css")
  ),
  card(
    card_header(
      icon("star"),
      "Card 1 header",
      toolbar(
        align = "right",
        toolbar_input_switch(id = "switch", label = "Toggle", value = FALSE),
        toolbar_input_button(id = "see", icon = icon("eye")),
        toolbar_input_button(id = "save", icon = icon("save"))
      )
    ),
    p("Card 1 body"),
    actionButton("activate_schedule", "Activate Schedule"),
    max_height = "500px",
    card_footer(
      toolbar(
        align = "left",
        toolbar_input_button(id = "go", label = "Go"),
        toolbar_input_button(id = "Exit", label = "Exit")
      )
    )
  ),
  toolbar(
    align = "left",
    toolbar_input_switch(
      id = "test_switch",
      label = "Test Switch",
      value = TRUE
    ),
    toolbar_input_switch(
      id = "test_switch2",
      label = "Test Switch 2",
      value = TRUE
    ),
    toolbar_input_button(id = "love2", icon = icon("heart"), tooltip = "Like"),
    toolbar_input_button(
      id = "comment2",
      icon = icon("comment"),
      tooltip = "Comment"
    )
  ),
  card(
    card_header(
      "Card 2 header",
      toolbar(
        align = "right",
        downloadLink(
          "download2",
          "Download",
        )
      ),
    ),
    p("Card 2 body"),
    actionButton("activate_schedule2", "Activate Schedule"),
    max_height = "500px",
    card_footer(
      toolbar(
        align = "right",
        toolbar_input_button(
          id = "paragraph2",
          icon = icon("paragraph")
        )
      )
    )
  ),
  toolbar(
    align = "left",
    gap = "10",
    toolbar_input_button(id = "test", icon = icon("star")),
    toolbar_input_button(id = "love", icon = icon("heart")),
    toolbar_input_button(id = "comment", icon = icon("comment"))
  )
)

server <- function(input, output) {
  observeEvent(input$activate_schedule, {
    updateActionButton(
      inputId = "calendar",
      disabled = FALSE
    )
  })
}


shinyApp(ui = ui, server = server)

@elnelson575 elnelson575 force-pushed the feat/toolbar-input-switch branch from 7d3e093 to d41509d Compare December 9, 2025 19:40
commit a37f90a
Author: E Nelson <liz.nelson@posit.co>
Date:   Wed Dec 17 14:24:38 2025 -0500

    feat: Add toolbar input select (#1260)

    Adding an input select optimized for use in toolbars.

    Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>

commit 6cf620b
Author: E Nelson <liz.nelson@posit.co>
Date:   Fri Dec 12 17:23:10 2025 -0500

    feat: Add toolbar spacer (#1265)

    Adding a dividing line and space option to allow for more customized toolbar spacing.

    Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
    Co-authored-by: elnelson575 <elnelson575@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants