Giter VIP home page Giter VIP logo

shinybones's Introduction

ShinyBones

Travis build status lifecycle

shinybones is an R package that provides a highly opinionated way to organize large, multi-page shiny dashboards. 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.

Installation

You can install shinybones from github:

remotes::install_github('ramnathv/shinybones')

shinybones 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.

shinybones::sb_add_snippets()

Usage

You can easily scaffold a shinydashboard app using shinybones by clicking on the New Project menu in RStudio

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.

ToDos

  • 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)

Acknowledgements

This package was initially named satin, but had to be renamed since it was already in use by a now-archived package on CRAN. Thanks to @dgrtwo for suggesting the name shinybones, which is very appropriate since this package allows you to create a skeleton of a dashboard app!

shinybones's People

Contributors

dgrtwo avatar ramnathv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shinybones's Issues

Allow multiple modules to be laid out on a page

In many situations, a page consists of standalone submodules that are assembled as a combination of tabs and rows. This can be made easier by extending the API of satin.

- text: Item 1
   menu:
     - text: Sub Item 1
       module:
          tabs:
          - text: Tab 1
            module:
             tab1:
               id: tab1
          - text: Tab 2
            module: tab2

In this case module_tabs is a satin module that accepts a list of modules and turns them into tabs on a page. module_rows would turn a list of modules into rows. The advantage of this approach is consistency and the ability for users to define custom higher-level modules to aggregate submodules.

It does introduce an extra layer of nesting which might be annoying, but I think consistency scores higher than the annoyance introduced by a little nesting.

fix display_page to use tab names

Right now, display_page is based on the text, and that isn't always unique. This should be modified so you can use the tab names (or something else that may be unique).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.