Description Usage Arguments Value Examples
Create a Chakra component with React states and/or hooks.
1 | withStates(component, states)
|
component |
a React component |
states |
named list of states; a state value can be an R object
serializable to JSON, a React component ( |
A component to use in chakraComponent
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | library(shiny)
library(shinyChakraUI)
ui <- chakraPage(
br(),
chakraComponent(
"mycomponent",
withStates(
Tag$Fragment(
Tag$Container(
maxW = "xl",
centerContent = TRUE,
bg = "orange.50",
Tag$Heading(
getState("heading")
),
Tag$Text(
"I'm just some text."
)
),
br(),
Tag$Divider(),
br(),
Tag$Button(
colorScheme = "twitter",
display = "block",
onClick = jseval(
"() => setState('heading', 'I am the new heading.')"
),
"Click me to change the heading"
)
),
states = list(heading = "I am the heading.")
)
)
)
server <- function(input, output, session){}
if(interactive()){
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.