shiny-bslib
Skill2 starsChanged 6 months agoMITView on GitHub
Build modern Shiny dashboards and applications using bslib (Bootstrap 5). Use when creating new Shiny apps, modernizing legacy apps (fluidPage, fluidRow/column, tabsetPanel, wellPanel, shinythemes), or working with bslib page layouts, grid systems, cards, value boxes, navigation, sidebars, filling layouts, theming, accordions, tooltips, popovers, toasts, or bslib inputs. Assumes familiarity with basic Shiny.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- BrightGold70/skillsedited, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- BrightGold70/skills★ 198% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- alt-textSkill
- brand-ymlSkill
- cliSkill
- cran-extrachecksSkill
- create-release-checklistSkill
- critical-code-reviewerSkill
- describe-designSkill
- ggsqlSkill
- implementSkill
- maintainer-declineSkill
- miraiSkill
- pr-createSkill
- pr-threads-addressSkill
- pr-threads-resolveSkill
- quarto-authoringSkill
- r-cli-appSkill
- release-postSkill
- review-testingSkill
- r-package-developmentSkill
- shiny-bslib-themingSkill
- testing-r-packagesSkill
- working-onSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 181
Add theme with bs_theme() (consider Bootswatch for quick start)
- Distinctive: line 182
Create sidebar with inputs for filtering/controls
- Very specific: line 183
Add value boxes at top for key metrics (set fill = FALSE on container)
- Very specific: line 186
Add thematic::thematic_shiny() for plot theming
- Very specific: line 203
Wrap outputs in
card(full_screen = TRUE): when building dashboards -- full-screen expansion is a high-value feature - Very specific: line 213
Avoid directly nesting card() containers.
- Very specific: line 214
Only use layout_columns() and layout_column_wrap() for laying out multiple elements.
- Very specific: line 215
Never nest page_*() functions.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Modern Shiny Apps with bslib
Build professional Shiny dashboards using bslib's Bootstrap 5 components and layouts. This skill focuses on modern UI/UX patterns that replace legacy Shiny approaches.
Quick Start
Single-page dashboard:
library(shiny)
library(bslib)
ui <- page_sidebar(
title = "My Dashboard",
theme = bs_theme(version = 5), # "shiny" preset by default
sidebar = sidebar(
selectInput("variable", "Variable", choices = names(mtcars))
),
layout_column_wrap(
width = 1/3,
fill = FALSE,
value_box(title = "Users", value = "1,234", theme = "primary"),
value_box(title = "Revenue", value = "$56K", theme = "success"),
value_box(title = "Growth", value = "+18%", theme = "info")
),
card(
full_screen = TRUE,
card_header("Plot"),
plotOutput("plot")
)
)
server <- function(input, output, session) {
output$plot <- renderPlot({
hist(mtcars[[input$variable]], main = input$variable)
})
}
shinyApp(ui, server)Multi-page dashboard:
ui <- page_navbar(
title = "Analytics Platform",
theme = bs_theme(version = 5),
nav_panel("Overview", overview_ui),
nav_panel("Analysis", analysis_ui),
nav_panel("Reports", reports_ui)
)Core Concepts
Page Layouts
page_sidebar()-- Single-page dashboard with sidebar (most common)page_navbar()-- Multi-page app with top navigation barpage_fillable()-- Viewport-filling layout for custom arrangementspage_fluid()-- Scrolling layout for long-form content
See page-layouts.md for detailed guidance.
Grid Systems
layout_column_wrap()-- Uniform grid with auto-wrapping (recommended for most cases)layout_columns()-- 12-column Bootstrap grid with precise control
See grid-layouts.md for detailed guidance.
Cards
Primary container for dashboard content. Support headers, footers, multiple body sections, and full-screen expansion.
See cards.md for detailed guidance.
Value Boxes
Display key metrics and KPIs with optional icons, sparklines, and built-in theming.
See value-boxes.md for detailed guidance.
Navigation
- Page-level:
page_navbar()for multi-page apps - Component-level:
navset_card_underline(),navset_tab(),navset_pill()for tabbed content
See navigation.md for detailed guidance.
Sidebars
- Page-level:
page_sidebar()orpage_navbar(sidebar = ...) - Component-level:
layout_sidebar()within cards - Supports conditional content, dynamic open/close, accordions
resizable = TRUEby default — users can drag the edge to resize on desktop
See sidebars.md for detailed guidance.
Filling Layouts
The fill system controls how components resize to fill available space. Key concepts: fillable containers, fill items, fill carriers. Fill activates when containers have defined heights.
See filling.md for detailed guidance.
Theming
bs_theme()with Bootswatch themes for quick styling- Custom colors:
bg,fg,primaryaffect hundreds of CSS rules - Fonts:
font_google()for typography - Dynamic theming:
input_dark_mode()+session$setCurrentTheme()
See theming.md for detailed guidance.
UI Components
- Accordions -- Collapsible sections, especially useful in sidebars
- Tooltips -- Hover-triggered help text
- Popovers -- Click-triggered containers for secondary UI/inputs
- Toasts -- Temporary notification messages
- Toolbars -- Compact horizontal strips of buttons, selects, and dividers for card headers and footers
See accordions.md, tooltips-popovers.md, toasts.md, and toolbars.md.
Icons
Recommended: bsicons package (Bootstrap Icons, designed for bslib):
bsicons::bs_icon("graph-up")
bsicons::bs_icon("people", size = "2em")Browse icons: https://icons.getbootstrap.com/
Alternative: fontawesome package:
fontawesome::fa("envelope")Accessibility for icon-only triggers: When an icon is used as the sole trigger for a tooltip, popover, or similar interactive element (no accompanying text), it must be accessible to screen readers. By default, icon packages mark icons as decorative (aria-hidden="true"), which hides them from assistive technology.
bsicons::bs_icon(): Providetitle— this automatically setsa11y = "sem"tooltip( bs_icon("info-circle", title = "More information"), "Tooltip content here" )fontawesome::fa(): Seta11y = "sem"and providetitletooltip( fa("circle-info", a11y = "sem", title = "More information"), "Tooltip content here" )
The title should describe the purpose of the trigger (e.g., "More information", "Settings"), not the icon itself (e.g., not "info circle icon").
Special Inputs
input_switch()-- Toggle switch (modern checkbox alternative)input_dark_mode()-- Dark mode toggleinput_task_button()-- Button for long-running operationsinput_code_editor()-- Code editor with syntax highlightinginput_submit_textarea()-- Textarea with explicit submission
See inputs.md for detailed guidance.
Common Workflows
Building a Dashboard
- Choose page layout:
page_sidebar()(single-page) orpage_navbar()(multi-page) - Add theme with
bs_theme()(consider Bootswatch for quick start) - Create sidebar with inputs for filtering/controls
- Add value boxes at top for key metrics (set
fill = FALSEon container) - Arrange cards with
layout_column_wrap()orlayout_columns() - Enable
full_screen = TRUEon all visualization cards - Add
thematic::thematic_shiny()for plot theming
Modernizing an Existing App
See migration.md for a complete mapping of legacy patterns to modern equivalents. Key steps:
- Replace
fluidPage()withpage_sidebar()orpage_navbar() - Replace
fluidRow()/column()withlayout_columns() - Wrap outputs in
card(full_screen = TRUE) - Add
theme = bs_theme(version = 5) - Convert key metrics to
value_box()components - Replace
tabsetPanel()withnavset_card_underline()
Guidelines
- Prefer bslib page functions (
page_sidebar(),page_navbar(),page_fillable(),page_fluid()) over legacy equivalents (fluidPage(),navbarPage()) - Use
layout_column_wrap()orlayout_columns()for grid layouts instead offluidRow()/column(), which don't support filling layouts - Wrap outputs in
card(full_screen = TRUE)when building dashboards -- full-screen expansion is a high-value feature - Set
fill = FALSEonlayout_column_wrap()containers holding value boxes (they shouldn't stretch to fill height) - Pin Bootstrap version: include
theme = bs_theme(version = 5)or a preset theme - Use
thematic::thematic_shiny()in the server so base R and ggplot2 plots match the app theme - Use responsive widths like
width = "250px"inlayout_column_wrap()for auto-adjusting columns - Group sidebar inputs with
accordion()when sidebars have many controls - See migration.md for mapping legacy Shiny patterns to modern bslib equivalents
Avoid Common Errors
- Avoid directly nesting
card()containers.navset_card_*()functions are already cards;nav_panel()content goes directly inside them without wrapping incard() - Only use
layout_columns()andlayout_column_wrap()for laying out multiple elements. Single children should be passed directly to their container functions. - Never nest
page_*()functions. Only use one top-level page function per app.
Reference Files
- migration.md -- Legacy Shiny to modern bslib migration guide
- page-layouts.md -- Page-level layout functions and patterns
- grid-layouts.md -- Multi-column grid systems
- cards.md -- Card components and features
- value-boxes.md -- Value boxes for metrics and KPIs
- navigation.md -- Navigation containers and patterns
- sidebars.md -- Sidebar layouts and organization
- filling.md -- Fillable containers and fill items
- theming.md -- Basic theming (colors, fonts, Bootswatch). See shiny-bslib-theming skill for advanced theming
- accordions.md -- Collapsible sections and sidebar organization
- tooltips-popovers.md -- Hover tooltips and click-triggered popovers
- toasts.md -- Temporary notification messages
- toolbars.md -- Toolbar components for card headers and footers
- inputs.md -- Special bslib input widgets
- best-practices.md -- bslib-specific patterns and common gotchas
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

