HTML Widgets for R

A framework for creating HTML widgets that render in various contexts including the R console, 'R Markdown' documents, and 'Shiny' web applications.


htmlwidgets 1.3

  • All files and directories under the inst/htmlwidgets/ directory of a widget package will be copied when a widget is rendered due to an unintended change in #306. Only the single WIDGET.js file should be copied (where WIDGET is the widget name). Fixed via #312.

  • Support for async Shiny. Widget render functions that use the default implementation of htmlwidgets::shinyRenderWidget can receive promises of widget objects (you can, of course, continue to use regular widget objects as well).

    See for more about async Shiny.

htmlwidgets 1.2

  • htmlwidgets can be created without a package, without yaml, and/or without JavaScript binding. (#304, #305)

  • Use RStudio Page Viewer for full page widgets.

  • Fix #297: Setting background in saveWidget() is broken

htmlwidgets 1.1

  • The saveWidget's background parameter could not process hex color codes, due to changes introduced in htmlwidgets 1.0. (#297)

htmlwidgets 1.0

  • Fix issues with self-contained mode when used with new versions of pandoc. (#289)

htmlwidgets 0.9

  • Starting with R 3.4.0, a "Calling 'structure(NULL, *)' is deprecated" warning would occur when shinyRenderWidget encountered a NULL value. (#269)

  • Fix edge case where using dynamic HTML dependencies from a widget binding's JS factory function would fail.

htmlwidgets 0.8

  • Export getDependency function

  • onRender hooks were firing too early when used in Shiny apps.

  • Widget IDs: only restore random.seed when non-NULL

htmlwidgets 0.7

  • Pass knitr options to saveWidget

  • Ensure that scaffoldWidget opens files correctly within RStudio

  • The resize handler also works for the JavaScript events and now so that widgets inside the Bootstrap collapse class can be displayed

  • Fix references to vignettes in documentation

  • Add elementId parameter to widget function generated by scaffoldWidget

  • More robust method of generating unique widget IDs

  • Modify advanced and sizing vignettes to use new style widget declarations

htmlwidgets 0.6

  • Introduce new scheme for defining JavaScript bindings that will make it easier for widgets to gain access to other widget instances on the page.

  • Add onRender hook for widgets to execute custom JavaScript code after rendering.

  • Add appendContent and prependContent functions for adding HTML to a widget rendered in a static context (i.e. R console or Rmd)

  • Fix a bug where the string "" in the widget data caused saveWidget() to have malformed output. (#168)

  • Tweak pandoc conversion used in saveWidget to prevent hanging with large htmlwidget script data elements (use "markdown" rather than "markdown-strict" as input format)

  • Increase pandoc stack size to 512M for saveWidget (often required for e.g. larger embedded leaflet maps). Stack size can also be controlled by the pandoc.stack.size option.

  • Import latest version of with_pandoc_safe_environment from rmarkdown

  • Fix issue that prevented calling renderValue() from within resize()

htmlwidgets 0.5

  • Add background parameter to saveWidget function

  • Fix a bug where "" appearing in widget data would break parsing

  • Fix a bug where multiple widgets on a page caused all but one to miss resize events

  • Sync vignettes with contents of htmlwidgets website

htmlwidgets 0.4

  • Use minified files while scaffolding widget wherever available

  • Suppress viewing widgets in non-interactive R sessions by default

  • Export the HTMLWidgets.staticRender function

  • Add a preRenderHook for widgets

  • Use jsonlite rather than RJSONIO for JSON serialization

  • Call widget.resize in more situations

htmlwidgets 0.3.2

  • Initial release to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.5.4 by Carson Sievert, 2 months ago

Report a bug at

Browse source code at

Authors: Ramnath Vaidyanathan [aut, cph] , Yihui Xie [aut] , JJ Allaire [aut] , Joe Cheng [aut] , Carson Sievert [aut, cre] , Kenton Russell [aut, cph] , Ellis Hughes [ctb] , RStudio [cph]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports grDevices, htmltools, jsonlite, yaml

Suggests knitr, rmarkdown, testthat

Enhances shiny

Imported by BioCircos, CALANGO, CNAIM, D3partitionR, DT, DiagrammeR, FORTLS, GenEst, HARtools, JBrowseR, LDAShiny, MDMAPR, NGLVieweR, PELVIS, PRISMA2020, Plasmidprofiler, QRAGadget, RAINBOWR, RagGrid, Rnvd3, RtD3, SMITIDvisu, SPARTAAS, SpatialEpiApp, UniprotR, Visualize.CRAN.Downloads, aceEditor, altair, antaresViz, apexcharter, aweSOM, basictabler, bea.R, billboarder, c3, canvasXpress, causact, chromoMap, clinDataReview, clinUtils, collapsibleTree, colourpicker, connectwidgets,, ctrialsgov, cubeview, d3Tree, data.validator, datacleanr, datadigest, deckgl, dextergui, diffr, diffviewer, discoveR, dsa, dygraphs, echarts4r, echarty, edgebundleR, eoffice, epiflows, excelR, faq, findInFiles, findInGit, flashCard, flexdashboard, flipdownWidgets, flow, focusedMDS, formattable, fusionchartsR, g3viz, gSEM, ggfacto, ggiraph, googleway, gradientPickerD3, graph3d, hchinamap, heatmaply, highcharter, hpackedbubble, htmlTable, htmltidy, hwordcloud, iCellR, ibmsunburst, iheatmapr, inlmisc, interacCircos, jsTree, jsTreeR, klustR, leafem, leaflegend, leaflet, leaflet.extras, leaflet.multiopacity, leaflet.opacity, leafpm, leafpop, leafsync, leaftime, learnr, listviewer, manifestoR, manipulateWidget, mapboxer, mapdeck, mapedit, mapview, mdsr, metricsgraphics, mindr, modchart, monaco, msaR, netSEM, networkD3, nomnoml, packageDiff, packer, pagemap, pairsD3, palmid, parallelPlot, parcats, parcoords, phylocanvas, pivottabler, pixels, plainview, plotly, ppcSpatial, processanimateR, profvis, pylintR, qrage, qtlcharts, r2d3, r3dmol, rAmCharts, rAmCharts4, radarchart, rbokeh, rchess, reactable, reactablefmtr, recogito, rgl, rhandsontable, robservable, rpivotTable, safetyGraphics, sankeywheel, scatterD3, scatterPlotMatrix, seasonalview, shiny.semantic, shinyCyJS, shinyTree, shinyaframe, shinybusy, shinydlplot, shinyjqui, shinyservicebot, shinytest, sigmaNet, sigmajs, simlandr, slickR, slideview, sortable, sparkline, sunburstR, svgPanZoom, thorn, threeBrain, threejs, tidycharts, tidycwl, timevis, tippy, tmap, treespace, trelliscopejs, twitterwidget, upsetjs, vegalite, vegawidget, visNetwork, visachartR, vizdraws, voronoiTreemap, vtree, wordcloud2.

Depended on by d3plus, d3po, dragulaR, imageviewer, widgetframe.

Suggested by CNVScope, DataVisualizations, EML, VOSONDash, airGRteaching, ambiorix, arulesViz, asciicast, bookdown, ciftiTools, cli, data.tree, distill, flipr, googleAnalyticsR, hereR, knitr, leaflet.esri, lime, muir, mwshiny, onemap, parlitools, pkgdepends, pkgdown, plumber, radix, reactR, rgeoprofile, spinifex, stringr, uavRmp, ursa, vip.

Enhanced by repr.

See at CRAN