STYLEGUIDE.md

Styleguide

Variables and argument names

Variables follow snake case naming style (unless they overlap with Shiny syntax). Try to give meaningful and self explanatory names.


my_variable <- 33

function(input, another_argument){}

Constants

Constants are defined with capital letter snake case and kept in the constants.R script (unless they're internal).

COLORS <- c("red", "green", "blue")

Function names

Function are called with snake_case.

Overriding shiny functions

When overriding shiny functions we usually follow shiny styling. Usually it requires creating a function with shiny.semantic syntax and then implementing a wrapper that follows shiny syntax.

!! Here argument names can actually follow camelCase syntax.

Example:

# semantic styling
action_button <- function(input_id, label, icon = NULL, width = NULL, ...) {
  ...
}

# shiny styling
actionButton <- function(inputId, label, icon = NULL, width = NULL, ...) {
  ...
}


Appsilon/shiny.semantic documentation built on April 21, 2024, 5:49 p.m.