Skip to content

timelyportfolio/excalidrawr

Repository files navigation

excalidrawr

Quick experiment to wrap Excalidraw for use in R.

Installation

remotes::install_github("timelyportfolio/excalidrawr")

Example

Currently, the package does very little except open an Excalidraw instance ready for your creative adventures.

library(excalidrawr)

excalidraw()

We can also use the onChange prop to communicate with Shiny.

library(htmltools)
library(shiny)
library(excalidrawr)

ui <- excalidraw(
  onChange = htmlwidgets::JS(
"
function(elements, state) {
  if(Shiny && Shiny.setInputValue) {
    Shiny.setInputValue('excal1', {elements})
  }
}
"
  ),
  elementId = "excal1"
)

server <- function(input, output, session) {
  draw <- reactive({
    input$excal1
  })
  draw_d <- debounce(draw, 1000)
  observe({
    str(draw_d())
  })
}

shinyApp(ui, server)

About

Excalidraw for R

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published