rstudio / rstudio/bslib

Cannot set `table-cell-padding` on "Lux" theme.

Open
#359 1 comment 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

# Header
## Load packages
library(shiny)
library(tidyverse)
library(DT)
library(bslib)

ui <- navbarPage("Test",
                 inverse = T,
                 collapsible = T,
                 theme = bs_theme(
                   version = 4,
                   bootswatch = "lux",
                   "font-size-base" = "1rem",
                   "table-cell-padding" = ".4rem"
                 ),
                 tabPanel(
                   title = "Data Tables", 
                   id = "data",
                   icon = icon("flask"),
                   fluidRow(
                     dataTableOutput("DT1")
                   )
                   
                 )
                 
)

server <- function(input, output, session) {
  output$DT1 <- renderDataTable({
    datatable(mtcars, 
              style = "bootstrap4",
              options = list(info = F,
                             searching = T,
                             paging = T,
                             autoWidth = T,
                             scrollX = T),
              filter = list(position = 'top', clear = FALSE),
              class = 'cell-border stripe compact',
              rownames = F)
  })
  
}

##
shinyApp(ui, server)

image

The table cell padding doesn't change when adding BS4 variable "table-cell-padding" when using the "lux" theme. It works when I use some other theme e.g. "flatly". I want the cells to be more compact and tight around the numbers/column names.

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 supplied Shiny example and inspect how bs_theme() handles the Bootstrap 4 table-cell-padding variable for the Lux theme. Compare its generated styling with the working Flatly theme and verify that the requested padding affects the rendered data table.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.