Skip to main content

Download

The Download widget allows you to download a file directly from your notebook, offering the feature as a customizable button.

Basic usage

First, ensure you have a file available at a known path that you want to download. For example, if you have a CSV file named data.csv in your working directory:

file_path = 'data.csv'

Now, we create a Download widget and configure file_path as the input variable and save it. If you click the download button, you will get the file directly without any conversion.

Widget Download

Usage to download any file

This widget is useful for offering downloads of any file type stored in your notebook's environment. Just specify the appropriate file path.

API reference

Basic

Setting nameTypeDescriptionDefault
File pathstringContext variable of the file path.
File namestringName of the file to download.output
Button textstringText to display on the button.

Advanced

Setting nameTypeDescriptionDefault
Verify pathbooleanWhether to verify the existence of the file pathtrue

Style

Container

Setting nameTypeDescriptionDefault
Container paddingstring/css_paddingPadding of the container.

Button

Setting nameTypeDescriptionDefault
Button widthstring/css_sizeWidth of the button.100%
Button heightstring/css_sizeHeight of the button.40px
Button typeprimary | dashed | link | text | defaultType of the button.primary
Button shaperound | circle | defaultShape of the button.default
Button colorstring/css_colorColor of the button.#007bff

Text

Setting nameTypeDescriptionDefault
Text colorstring/css_colorColor of the text.
Font sizestring/css_sizeSize of the text.
Font familystring/css_font_familyFont family of the text.
BoldbooleanWhether the text is bold.false

Position

Setting nameTypeDescriptionDefault
Vertical alignmentstart | center | endVertical alignment of the containercenter
Horizontal alignmentleft | center | rightHorizontal alignment of the containercenter

See also

  • All widgets — browse the full widget catalog.
  • Upload — the counterpart for letting users upload files.
  • Data Export — export tabular data as CSV or Excel.