rstudio / rstudio/bslib

Consistent height of widgets

Open
#953 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

Even though I didn't specify any theme, the default theme is pretty good looking already, but I noticed that all the widgets seem to be a bit taller, which takes up some space, that's fine, they still align.
But when I used the extension Buttons in DT, I noticed the problem, it doesn't have the same height as the search box and the pagination control in DT, unify it in the future, or will I have to add a custom theme?
Here is an example to explain the misalignment I see, compared to shiny without bslib.

library(shiny)
library(DT)

shinyApp(
  ui <- fluidPage(
    fluidRow(
      column(6, DTOutput("table_1")),
      column(6, DTOutput("table_2")),
    )
  ),
  server <- function(input, output, session) {
    df <- data.frame(a = 1:3, b = 4:6, c = 7:9)
    output$table_1 <- renderDT({
      datatable(
        df,
        extensions = 'Buttons',
        options = list(
          dom = "Brftip",
          buttons = list(
            "csv", "copy"
          )
        )
      )
    })
    output$table_2 <- renderDT({
      datatable(
        df,
        extensions = 'Buttons',
        options = list(
          dom = "Bprt",
          buttons = list(
            "csv", "copy"
          )
        )
      )
    })
  }
)
library(shiny)
library(DT)
library(bslib)

shinyApp(
  ui <- page_fluid(
    fluidRow(
      column(6, DTOutput("table_1")),
      column(6, DTOutput("table_2")),
    )
  ),
  server <- function(input, output, session) {
    df <- data.frame(a = 1:3, b = 4:6, c = 7:9)
    output$table_1 <- renderDT({
      datatable(
        df,
        extensions = 'Buttons',
        options = list(
          dom = "Brftip",
          buttons = list(
            "csv", "copy"
          )
        )
      )
    })
    output$table_2 <- renderDT({
      datatable(
        df,
        extensions = 'Buttons',
        options = list(
          dom = "Bprt",
          buttons = list(
            "csv", "copy"
          )
        )
      )
    })
  }
)

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the two minimal Shiny/DT examples in the issue and compare the Buttons, search box, and pagination control heights with and without bslib. Inspect the generated widget styling and verify that the affected controls align consistently in both layouts; done means the reported misalignment is resolved without requiring a custom theme.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, r, scss
Domain
design, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.