Title: | Lightweight Modern & Responsive Card Component for 'shiny' |
---|---|
Description: | Responsive and modern 'HTML' card essentials for 'shiny' dashboard. This novel card component in 'Bootstrap' provides a flexible and extensible content container with multiple variants and options for building robust 'R' based apps e.g for graph build or machine learning projects. The features rely on a combination of 'JQuery' <https://jquery.com> and 'CSS' styles to improve the card functionality. |
Authors: | Obinna Obianom [aut, cre] |
Maintainer: | Obinna Obianom <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.2.0 |
Built: | 2024-11-19 04:25:28 UTC |
Source: | https://github.com/oobianom/card.pro |
The current function allows inclusion of jQuery in an HTML output
add.JQuery(version = "3.5.1")
add.JQuery(version = "3.5.1")
version |
jQuery version |
script tag with jQuery link
This function holds significance across the entire package, particularly in scenarios where a specific HTML output lacks the inclusion of the jQuery script required by other functions within this package. It serves as a crucial mechanism for ensuring that functionalities within the package remain operable even when the necessary jQuery script is absent from the HTML page by default knitting. By providing a fallback option, this function enhances the robustness and reliability of the package, allowing it to gracefully handle situations where jQuery is not explicitly included. Its role is pivotal in maintaining consistent behavior and functionality across diverse HTML environments, thereby facilitating seamless integration and usage of the package across various web development contexts.
add.JQuery() add.JQuery("3.7.0") # add a specific version
add.JQuery() add.JQuery("3.7.0") # add a specific version
Customizable sidebar panel for inclusion of various UI elements
altPanel(..., width = 4, border = FALSE, shadow = FALSE)
altPanel(..., width = 4, border = FALSE, shadow = FALSE)
... |
List of content |
width |
Width of the sidebar panel |
border |
Should border be declared for the panel |
shadow |
Should a shadow be added to the panel |
Creates an alternate container for displaying contents
For more information on the features of the sidebar panel, look through the Github examples
altPanel("content 2")
altPanel("content 2")
Widely used card component from Bootstrap with improvements to improve utility
card.pro( ..., title, collapsed = FALSE, width = 12, tabs = NULL, icon = NULL, xtra.header.content = NULL, footer = NULL, togglebtn = TRUE, editbtn = TRUE, expandbtn = TRUE, colorbtn = TRUE, removebtn = TRUE, sortable = TRUE, sidebar = NULL, shadow = TRUE, header.bg = c("white", "green", "greenDark", "greenLight", "purple", "magenta", "pink", "pinkDark", "blueLight", "teal", "blue", "blueDark", "darken", "yellow", "orange", "orangeDark", "red", "redLight"), alert.text = NULL, alert.type = c("warning", "info", "success", "danger") )
card.pro( ..., title, collapsed = FALSE, width = 12, tabs = NULL, icon = NULL, xtra.header.content = NULL, footer = NULL, togglebtn = TRUE, editbtn = TRUE, expandbtn = TRUE, colorbtn = TRUE, removebtn = TRUE, sortable = TRUE, sidebar = NULL, shadow = TRUE, header.bg = c("white", "green", "greenDark", "greenLight", "purple", "magenta", "pink", "pinkDark", "blueLight", "teal", "blue", "blueDark", "darken", "yellow", "orange", "orangeDark", "red", "redLight"), alert.text = NULL, alert.type = c("warning", "info", "success", "danger") )
... |
The elements to include within the body of the card |
title |
The text to display in the header title |
collapsed |
If |
width |
Select a width from 1 to 12 to indicate the size of the card |
tabs |
optional. A list containing tabs items, see example |
icon |
Header icon e.g. shiny::icon('fire') |
xtra.header.content |
additional header content e.g. "Hi" |
footer |
Footer content if any |
togglebtn |
show toggle button |
editbtn |
show header title edit button |
expandbtn |
show card expand button |
colorbtn |
show header color chooser |
removebtn |
show card closer button |
sortable |
If |
sidebar |
optional. include side bar content |
shadow |
logical. add shadow to the card exterior |
header.bg |
Header background color style |
alert.text |
Enter text for the alert portion. Leave as NULL to exclude the alert |
alert.type |
Indicate the type of alert to include, choices are "warning", "info", "success", "danger" |
HTML code of the container with a class called card.pro that holds the items
For more information on the features of the card, visit the examples section of the help documentation
# Example 1 if (interactive()) { library(shiny) library(card.pro) shiny::shinyApp( ui = fluidPage( titlePanel("Change customizations. Its preserved across refresh!"), moveable( card.pro( "Lorem ipsum odor amet.", title = "Box 1", icon = icon("fire"), tabs = list( tabEntry( "Tab 1", textInput("nor1", "Enter name"), "Content for 1" ), tabEntry( "Tab 2", actionButton("nor1", "Try click"), "sample" ) ) ), card.pro( "Another something", title = "Box 2", width = 6, header.bg = "blue", alert.text = "Its an alert!", colorbtn = FALSE, editbtn = FALSE ) ) ), server = empty.server ) } # Example 2 if (interactive()) { library(shiny) library(card.pro) shiny::shinyApp( ui = fluidPage( titlePanel("Change order and refresh"), wrapper( moveable( card.pro( "A plot for test", textInput("test6", "Plot title"), actionButton("test9", "Make plot"), title = "Box 3", width = 6, header.bg = "red", collapsed = TRUE, sortable = FALSE ), card.pro( "Box 4 content", "shinyappstore.com", title = "Box 1", width = 8, header.bg = "red", sidebar = div( "My settings", textInput("test2", "Input change"), actionButton("test3", "Click to save") ) ) ) ) ), server = empty.server ) }
# Example 1 if (interactive()) { library(shiny) library(card.pro) shiny::shinyApp( ui = fluidPage( titlePanel("Change customizations. Its preserved across refresh!"), moveable( card.pro( "Lorem ipsum odor amet.", title = "Box 1", icon = icon("fire"), tabs = list( tabEntry( "Tab 1", textInput("nor1", "Enter name"), "Content for 1" ), tabEntry( "Tab 2", actionButton("nor1", "Try click"), "sample" ) ) ), card.pro( "Another something", title = "Box 2", width = 6, header.bg = "blue", alert.text = "Its an alert!", colorbtn = FALSE, editbtn = FALSE ) ) ), server = empty.server ) } # Example 2 if (interactive()) { library(shiny) library(card.pro) shiny::shinyApp( ui = fluidPage( titlePanel("Change order and refresh"), wrapper( moveable( card.pro( "A plot for test", textInput("test6", "Plot title"), actionButton("test9", "Make plot"), title = "Box 3", width = 6, header.bg = "red", collapsed = TRUE, sortable = FALSE ), card.pro( "Box 4 content", "shinyappstore.com", title = "Box 1", width = 8, header.bg = "red", sidebar = div( "My settings", textInput("test2", "Input change"), actionButton("test3", "Click to save") ) ) ) ) ), server = empty.server ) }
For use in simple shiny apps not requiring server functions
empty.server(input, output, session)
empty.server(input, output, session)
input |
the input object |
output |
the output object |
session |
the session object |
Empty server function
if(interactive()){ library(shiny) library(card.pro) ui = fluidPage("Obi Obianom") shinyApp(ui = ui, server = empty.server) }
if(interactive()){ library(shiny) library(card.pro) ui = fluidPage("Obi Obianom") shinyApp(ui = ui, server = empty.server) }
A grid that holds draggable items
moveable(...)
moveable(...)
... |
The elements to include within the body of the moveable grid |
HTML code of a container that allows items within it to be draggable
For more information on the features of a sortable grid, visit the examples section of the help documentation
moveable( htmltools::tags$div("A"), htmltools::tags$div("B") )
moveable( htmltools::tags$div("A"), htmltools::tags$div("B") )
Customizable main panel for inclusion of various UI elements
primePanel(..., width = 8, border = FALSE, shadow = FALSE)
primePanel(..., width = 8, border = FALSE, shadow = FALSE)
... |
List of content |
width |
Width of the main panel |
border |
Should border be declared for the panel |
shadow |
Should a shadow be added to the panel |
Creates a container for displaying contents
For more information on the features of the main panel, look through the Github examples
primePanel("content 1")
primePanel("content 1")
A simple row div
row(...)
row(...)
... |
The elements to include within the body of the row |
An HTML containing elements of a container with class row to be embedded in a page
row(shiny::div(width=12,"Hello nextGenShinyApps"))
row(shiny::div(width=12,"Hello nextGenShinyApps"))
Create a tab panel item that is enclosed by a list
tabEntry(title, ...)
tabEntry(title, ...)
title |
title of the tab |
... |
content of the tab |
An list containing the title and content of a tab
if (interactive()) { tabEntry("Summary", "Convallis aesus.") tabEntry("Summary", "nextGenShinyApps.") }
if (interactive()) { tabEntry("Summary", "Convallis aesus.") tabEntry("Summary", "nextGenShinyApps.") }
Fetch the location of the scripts
template.loc(template = "bundle")
template.loc(template = "bundle")
template |
The type of template to fetch |
A path for the location of the package
template.loc('bundle')
template.loc('bundle')
Use the package scripts and stylesheets in a page
use.cardpro( theme = letters[1:5], jquery = FALSE, jqueryui = TRUE, fontawesome = FALSE, template = "bundle", fix.header = FALSE )
use.cardpro( theme = letters[1:5], jquery = FALSE, jqueryui = TRUE, fontawesome = FALSE, template = "bundle", fix.header = FALSE )
theme |
The template type |
jquery |
option. logical. include jquery |
jqueryui |
option. logical. include jquery UI |
fontawesome |
option. logical. include fontawesome |
template |
template folder |
fix.header |
logical. fix header if titlePanel2() is used in UI |
A list of files to be inserted in the header of a page
if(interactive()){ use.cardpro() use.cardpro(theme="a",jqueryui = T, fontawesome = F) }
if(interactive()){ use.cardpro() use.cardpro(theme="a",jqueryui = T, fontawesome = F) }
Create a wrapper div for pannels
wrapper( ..., bg = c("default", "primary", "secondary", "warning", "info", "danger", "success") )
wrapper( ..., bg = c("default", "primary", "secondary", "warning", "info", "danger", "success") )
... |
div contents |
bg |
background color of the wrapper |
a container for other containers
wrapper(altPanel("hello"), shiny::mainPanel("test")) wrapper(shiny::mainPanel("hello"), shiny::column(width = 2, "test"))
wrapper(altPanel("hello"), shiny::mainPanel("test")) wrapper(shiny::mainPanel("hello"), shiny::column(width = 2, "test"))