Download Button to download a pn.Row() from my app

is it possible to add a download button that will download a pn.Row() containing plots and other goodies?
something that will allow the user to save it as an html file on his computer
can i somehow use FileDownload for this purpose?

so far i was able to make a function that is triggered by a button that runs pn.Row().save(‘test.html’)
but it wont let the user decide where to save it

Sure that’s possible, you just have to provide a callback which writes the HTML to a StringIO object and returns that, e.g.:

import io
import panel as pn


vegalite = {
  "$schema": "",
  "data": {"url": ""},
  "mark": "bar",
  "encoding": {
    "x": {"aggregate": "sum", "field": "yield", "type": "quantitative"},
    "y": {"field": "variety", "type": "nominal"},
    "color": {"field": "site", "type": "nominal"}
vgl_pane = pn.panel(vegalite, height=240)

layout = pn.Row(vgl_pane)

def download_layout():
    sio = io.StringIO()
    return sio

download = pn.widgets.FileDownload(filename='layout.html', callback=download_layout)


Hi @alonsht

You can find more details about embedding and saving here Deploy and Export — Panel 0.12.0 documentation