build-shiny-module

Solid

Build reusable Shiny modules with proper namespace isolation using NS(). Covers module UI/server pairs, reactive return values, inter-module communication, and nested module composition. Use when extracting a reusable component from a growing Shiny app, building a UI widget used in multiple places, encapsulating complex reactive logic behind a clean interface, or composing larger applications from smaller, testable units.

Web & Frontend 26 stars 4 forks Updated today MIT

Install

View on GitHub

Quality Score: 81/100

Stars 20%
48
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Build Shiny Module Create reusable Shiny UI/server module pairs with proper namespace isolation, reactive communication, and composability. ## When to Use - Extracting a reusable component from a growing Shiny app - Building a UI widget that will be used in multiple places - Encapsulating complex reactive logic behind a clean interface - Composing larger applications from smaller, testable units ## Inputs - **Required**: Module purpose and functionality description - **Required**: Input/output contract (what the module receives and returns) - **Optional**: Whether the module nests other modules (default: no) - **Optional**: Framework context (golem, rhino, or vanilla) ## Procedure ### Step 1: Define the Module Interface Before writing code, define what the module accepts and returns: ```text Module: data_filter Inputs: reactive dataset, column names to filter on Outputs: reactive filtered dataset UI: filter controls (selectInput, sliderInput, dateRangeInput) ``` **Got:** Clear contract specifying reactive inputs, reactive outputs, and UI elements. **If fail:** If the interface is unclear, the module is probably too broad. Split it into smaller modules with single responsibilities. ### Step 2: Create the Module UI Function ```r #' Data Filter Module UI #' #' @param id Module namespace ID #' @return A tagList of filter controls #' @export dataFilterUI <- function(id) { ns <- NS(id) tagList( selectInput( ns("column"), "Filter column", cho...

Details

Author
pjt222
Repository
pjt222/agent-almanac
Created
1 years ago
Last Updated
today
Language
R
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category