write_widget: Write HTML widget to file

write_widgetR Documentation

Write HTML widget to file

Description

Writes an HTML widget's main container ⁠<div>⁠ and data ⁠<script>⁠ tags to file.

Usage

write_widget(x, path)

Arguments

x

HTML widget object.

path

File path to write the HTML widget's core tags to.

Details

Other than htmlwidgets::saveWidget(), this function does not write a complete HTML document but only the widget's core tags. Hence it is intended to create files which are in turn included in another HTML file, e.g. via a static site generator. The HTML widget's dependencies must be handled separately, e.g. using write_widget_deps().

To directly get the HTML widget's core tags as a character scalar, use as.character(htmltools::tagList(x)).

Value

The content written to path as a character scalar, invisibly.

See Also

Other HTML widget functions: write_widget_deps()


salim-b/pal documentation built on Feb. 28, 2025, 6:51 p.m.