A highly opinionated framework for building shiny dashboards.
Branch: master
Clone or download
Latest commit fa8c3b9 Feb 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R add .process_module to process modules Feb 18, 2019
inst update template Feb 17, 2019
man update docs Feb 17, 2019
.Rbuildignore initial commit Jan 28, 2019
.gitignore update gitignore Feb 3, 2019
DESCRIPTION bump version Feb 18, 2019
LICENSE initial commit Jan 28, 2019
NAMESPACE run devtools::document() Feb 9, 2019
README.md add install instructions for snippets Feb 4, 2019
satin.Rproj update project settings Jan 30, 2019

README.md

Satin

NOTE: This package is under heavy development and the APIs are expected to change. So proceed with extreme caution!

Satin is an R package that provides a highly opinionated way to organize large, multi-page shiny apps. It allows users to focus on building independent modules for each page following a minimal set of conventions, and relegating all the boilerplate code involding in laying them out in the dashboard to a simple YAML configuration file.

dashboard

Installation

You can install satin from github:

remotes::install_github('ramnathv/satin')

Satin ships with two useful snippets stpage and stcomponent that lets you create page and component modules that follow the conventions. You can install it by running st_add_snippets. Note that you will need to restart RStudio for the snippets to be usable.

satin::st_add_snippets()

Usage

You can easily scaffold a satin dashboard app using the New Project menu in RStudio

satin-new-project

Conventions

  1. A module referred to as foo needs to specify the following functions:

    • ui: foo_ui
    • server: foo
    • sidebar: foo_ui_sidebar (optional)

  1. The layout for the dashboard is specified in YAML.

    • Each menu item becomes a menu item in the sidebar.
    • If a menu item has more than 1 child, the children become subitems.
    • If the child of a menu item has a tabs item, they are rendered as a tabSetPanel
    • Each item (page) is connected to a module by its name.
name: Main Dashboard
sidebar:
  - text: Finance
    icon: briefcase
    menu:
      - text: Registrations
        module: registrations
      - text: Subscriptions
        tabs:
          - text: Individual
            module: subscribers_individual
          - text: Group
            module: subscribers_group

  - text: People
    icon: user
    menu:
      - text: People
        tabs:
          - text: Team Size
            module: team_size
          - text: Organogram
            module: organogram

Development Process

  1. Each page is independently developed as a standalone module.
  2. Use the function preview_module to preview the module.
  3. Add it to the dashboard by editing _site.yml.

TODO

  • Hook up passing of data to each module
  • Wrap all utilities into a package
  • Automatically check if tabnames are unique
  • Allow factory modules that can accept static parameters
  • Fix bugs where when menu item has only one child, tabNames have to be same.
  • Allow deep linking at the tab level (by default)