| Title: | Animated Glass-Style Tabs and Multi-Select Filter for 'Shiny' |
| Version: | 0.1.1 |
| Description: | Tools for creating animated glassmorphism-style tab navigation and multi-select dropdown filters in 'shiny' applications. The package provides a tab navigation component and a searchable multi-select widget with multiple checkbox indicator styles, select-all controls, and customizable colour themes. The widgets are compatible with standard 'shiny' layouts and 'bs4Dash' dashboards. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/PrigasG/glasstabs, https://prigasg.github.io/glasstabs/ |
| BugReports: | https://github.com/PrigasG/glasstabs/issues |
| Imports: | htmltools (≥ 0.5.0), shiny (≥ 1.7.0) |
| Suggests: | bs4Dash, knitr, rmarkdown, spelling, testthat (≥ 3.0.0), mockery |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Language: | en-US |
| NeedsCompilation: | no |
| Packaged: | 2026-03-12 17:14:09 UTC; garthur |
| Author: | George Arthur [aut, cre] |
| Maintainer: | George Arthur <prigasgenthian48@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-13 13:30:13 UTC |
Shiny tag helper for a filter-tags display area tied to a glassMultiSelect
Description
Renders a <div> that the JS engine will populate with colored tag pills
whenever the corresponding glassMultiSelect() selection changes.
Usage
glassFilterTags(inputId, class = NULL)
Arguments
inputId |
The |
class |
Additional CSS classes for the container. |
Value
An htmltools tag.
Animated glass multi-select dropdown filter
Description
A stylized multi-select Shiny input with optional search, style switching,
select-all behavior, and programmatic updates via updateGlassMultiSelect().
Usage
glassMultiSelect(
inputId,
choices,
selected = NULL,
label = NULL,
placeholder = "Filter by Category",
all_label = "All categories",
check_style = c("checkbox", "check-only", "filled"),
show_style_switcher = TRUE,
show_select_all = TRUE,
show_clear_all = TRUE,
theme = "dark",
hues = NULL
)
Arguments
inputId |
Shiny input id. |
choices |
Named or unnamed character vector of choices. |
selected |
Initially selected values. Defaults to all choices when
|
label |
Optional field label shown above the widget. |
placeholder |
Trigger label when nothing is selected. |
all_label |
Label shown when all choices are selected. |
check_style |
One of |
show_style_switcher |
Show the Check / Box / Fill switcher row inside
the dropdown? Default |
show_select_all |
Show the "Select all" row? Default |
show_clear_all |
Show the "Clear all" footer link? Default |
theme |
Color theme. One of |
hues |
Optional named integer vector of HSL hue angles (0 to 360) for
the |
Details
The widget registers two Shiny inputs:
-
input$<inputId>: character vector of selected values -
input$<inputId>_style: active style string ("checkbox","check-only", or"filled")
By default, when selected = NULL, all choices are initially selected.
This preserves the existing package behavior.
Value
An htmltools::tagList containing the trigger button, dropdown
panel, and scoped <style> block.
Examples
fruits <- c(Apple = "apple", Banana = "banana", Cherry = "cherry")
# Minimal
glassMultiSelect("f", fruits)
# Lock style, hide extra controls
glassMultiSelect(
"f",
fruits,
check_style = "check-only",
show_style_switcher = FALSE,
show_select_all = FALSE,
show_clear_all = FALSE
)
# Light theme
glassMultiSelect("f", fruits, theme = "light")
Reactive helpers for glassMultiSelect values
Description
Convenience helper for extracting a multi-select widget's value and style
from Shiny's input object without using modules.
Usage
glassMultiSelectValue(input, inputId)
Arguments
input |
Shiny |
inputId |
Input id used in |
Value
A named list with two reactives:
selectedReactive character vector of selected values
styleReactive string for the active style
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(
useGlassTabs(),
glassMultiSelect("cats", c(A = "a", B = "b", C = "c"))
)
server <- function(input, output, session) {
ms <- glassMultiSelectValue(input, "cats")
observe({
message("Selected: ", paste(ms$selected(), collapse = ", "))
message("Style: ", ms$style())
})
}
shinyApp(ui, server)
}
Animated glass single-select dropdown
Description
A stylized single-select Shiny input with optional search, clear control,
selection-marker styling, and programmatic updates via updateGlassSelect().
Usage
glassSelect(
inputId,
choices,
selected = NULL,
label = NULL,
placeholder = "Select an option",
searchable = TRUE,
clearable = FALSE,
include_all = FALSE,
all_choice_label = "All categories",
all_choice_value = "__all__",
check_style = c("checkbox", "check-only", "filled"),
theme = "dark"
)
Arguments
inputId |
Shiny input id. |
choices |
Named or unnamed character vector of choices. |
selected |
Initially selected value. Defaults to |
label |
Optional field label shown above the widget. |
placeholder |
Trigger label when nothing is selected. |
searchable |
Logical. Show search input inside dropdown? Default
|
clearable |
Logical. Show clear control for removing the current
selection? Default |
include_all |
Logical. Prepend an explicit "All" option. Default
|
all_choice_label |
Label used for the explicit "All" option. |
all_choice_value |
Value used for the explicit "All" option. |
check_style |
One of |
theme |
Color theme. One of |
Details
The widget registers one Shiny input:
-
input$<inputId>: selected value as a length-1 character string, orNULLwhen nothing is selected
Value
An htmltools::tagList containing the single-select trigger,
dropdown panel, and scoped <style> block.
Examples
fruits <- c(Apple = "apple", Banana = "banana", Cherry = "cherry")
glassSelect("fruit", fruits)
glassSelect(
"fruit",
fruits,
selected = "banana",
clearable = TRUE
)
glassSelect(
"fruit",
fruits,
include_all = TRUE,
all_choice_label = "All fruits",
all_choice_value = "__all__"
)
glassSelect(
"fruit",
fruits,
check_style = "filled"
)
Reactive helper for glassSelect values
Description
Convenience helper for extracting a single-select widget's value from Shiny's
input object without using modules.
Usage
glassSelectValue(input, inputId)
Arguments
input |
Shiny |
inputId |
Input id used in |
Value
A reactive expression returning the current selected value as a
character scalar, or NULL when nothing is selected.
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(
useGlassTabs(),
glassSelect("fruit", c(Apple = "apple", Banana = "banana"))
)
server <- function(input, output, session) {
fruit <- glassSelectValue(input, "fruit")
observe({
print(fruit())
})
}
shinyApp(ui, server)
}
Define a single glass tab panel
Description
Used as child arguments inside glassTabsUI(). Each call defines one tab
button and its associated content pane.
Usage
glassTabPanel(value, label, ..., selected = FALSE)
Arguments
value |
A unique string identifier for this tab (e.g. |
label |
The text shown on the tab button. |
... |
UI elements for the pane content. |
selected |
Logical. Whether this tab starts selected. Only the first
|
Value
A list of class "glassTabPanel" consumed by glassTabsUI().
Examples
glassTabPanel("overview", "Overview",
shiny::h3("Welcome"),
shiny::p("This is the overview tab.")
)
Server logic for glass tabs
Description
Tracks the active tab and exposes it as a reactive value.
Usage
glassTabsServer(id)
Arguments
id |
Module id matching the |
Value
A reactive expression returning the active tab value.
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(
useGlassTabs(),
glassTabsUI(
"tabs",
glassTabPanel("a", "A", p("Tab A"), selected = TRUE),
glassTabPanel("b", "B", p("Tab B"))
)
)
server <- function(input, output, session) {
active <- glassTabsServer("tabs")
observe(print(active()))
}
shinyApp(ui, server)
}
Animated glass-style tab navigation UI
Description
Animated glass-style tab navigation UI
Usage
glassTabsUI(
id,
...,
selected = NULL,
wrap = TRUE,
extra_ui = NULL,
theme = NULL
)
Arguments
id |
Module namespace id. |
... |
One or more |
selected |
Value of the initially selected tab. |
wrap |
Logical. When |
extra_ui |
Optional additional UI placed to the right of the tab bar. |
theme |
One of |
Value
An htmltools::tagList ready to use in a Shiny UI.
Create a custom color theme for glass select widgets
Description
Create a custom color theme for glass select widgets
Usage
glass_select_theme(
mode = c("dark", "light"),
bg_color = NULL,
border_color = NULL,
text_color = NULL,
accent_color = NULL,
label_color = NULL
)
Arguments
mode |
Base theme preset. One of |
bg_color |
Background color of the trigger button and dropdown panel. |
border_color |
Border color. |
text_color |
Main text color. |
accent_color |
Accent color used for the animated tick, badge, checked-state highlights, and clear controls. |
label_color |
Optional label color. If |
Value
A named list of class "glass_select_theme".
Create a custom color theme for glassTabsUI
Description
Create a custom color theme for glassTabsUI
Usage
glass_tab_theme(
tab_text = NULL,
tab_active_text = NULL,
halo_bg = NULL,
halo_border = NULL,
content_bg = NULL,
content_border = NULL,
card_bg = NULL,
card_text = NULL
)
Arguments
tab_text |
Inactive tab text color. |
tab_active_text |
Active tab text color. |
halo_bg |
Halo background. |
halo_border |
Halo border. |
content_bg |
Tab content background. |
content_border |
Tab content border. |
card_bg |
Inner card background. |
card_text |
Inner card text color. |
Value
A named list of class "glass_tab_theme".
Update a glassMultiSelect widget
Description
Update the available choices and/or current selection of an existing
glassMultiSelect() input.
Usage
updateGlassMultiSelect(
session,
inputId,
choices = NULL,
selected = NULL,
check_style = NULL
)
Arguments
session |
Shiny session. |
inputId |
Input id of the widget. |
choices |
New choices, or |
selected |
New selected values, or |
check_style |
Optional new style string. One of |
Details
This function now follows Shiny-style update semantics more closely:
-
choices = NULLleaves choices unchanged -
selected = NULLleaves selection unchanged -
selected = character(0)clears the selection
When choices is supplied and selected is not, the browser side
keeps the intersection of the current selection and the new set of choices.
Update a glassSelect widget
Description
Update the available choices, current selection, and/or selection-marker
style of an existing glassSelect() input.
Usage
updateGlassSelect(
session,
inputId,
choices = NULL,
selected = NULL,
check_style = NULL
)
Arguments
session |
Shiny session. |
inputId |
Input id of the widget. |
choices |
New choices, or |
selected |
New selected value, or |
check_style |
Optional new style string. One of |
Details
This function follows Shiny-style update semantics:
-
choices = NULLleaves choices unchanged -
selected = NULLleaves selection unchanged -
selected = character(0)clears the selection -
check_style = NULLleaves the current style unchanged
When choices is supplied and selected is not, the browser side
keeps the current selection if it is still present in the new choices.
Value
No return value. Called for its side effect of updating the client-side widget.
Attach glasstabs CSS and JS dependencies
Description
Call this once in your UI — either inside fluidPage(), bs4DashPage(),
or any other Shiny page wrapper. It injects the required CSS and JS as
proper htmltools dependencies so they are deduplicated automatically.
Usage
useGlassTabs()
Value
An htmltools::htmlDependency object (invisible to the user,
consumed by Shiny's renderer).
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(
useGlassTabs(),
glassTabsUI("demo",
glassTabPanel("A", "Tab A", p("Content A")),
glassTabPanel("B", "Tab B", p("Content B"))
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
}