Block: DownloadButton
DownloadButton
block for configuring a button for downloading an asset.Overview
A DownloadButton
block is used for configuring a button to download an asset.
Two different button states can be configured:
- The
initialize
button state is for setting the path of the asset to be downloaded. - The
download
button state is for downloading the asset.
The asset is typically generated using a Grasshopper model. For more information, see the how to guides in the Workbench Documentation.
Example
Below is an example configuration.
kind: Solution
version: v0
router:
kind: Router
routes:
- frame: home-frame
frames:
home-frame:
kind: Frame
contents:
my-model:
kind: Model
modelFile: my-grasshopper-model.gh
subscribe:
- kind: DownloadButton
frame: home-frame
source: my-download-button
action: set
setInput: my-input-component
my-download-button:
kind: DownloadButton
initialize:
text: Generate CSV file
color: secondary
download:
text: Download CSV file
color: primary
subscribe:
- kind: Model
frame: home-frame
source: my-model
output: my-output-component
action: setButtonSettings
DownloadButtonConfig
A DownloadButton
block is used for configuring a button to download an asset. Two different button states can be configured: initialize
and download
. The initialize
button state is for setting the path of the asset to be downloaded. The download
button state is for downloading the asset.
Name | Type | Required | Description |
---|---|---|---|
kind |
"DownloadButton" |
Yes | A constant, DownloadButton . |
initialize |
ButtonCommonProps | Yes | An object for configuring the button state for setting the path of the asset to be downloaded. |
download |
ButtonCommonProps | Yes | The object for configuring the button state for downloading the asset. |
subscribe |
List<Subscription> | No | A list of objects for subscribing the DownloadButton block to other blocks. |
ButtonCommonProps
Name | Type | Required | Description |
---|---|---|---|
text |
string |
Yes | |
color |
ThemeColor | No | A constant that defines the theme colour to use for the button. Possible options are primary, secondary, success, danger, warning, info, light, dark, and link. The default is primary. |
href |
string |
No | A string specifying a hyperlink. Clicking the hyperlink will navigate the browser to the link provided and away from the current solution. When no button colour is defined, the button background will have no colour, and the link text will have the primary colour. |
ThemeColor
"primary"
"secondary"
"success"
"danger"
"warning"
"info"
"light"
"dark"
Subscription
DownloadButtonToModelSubscription
An object for configuring a subscription from a DownloadButton
block to a Model
block. The subscription allows the download button to retrieve the path of the asset to be downloaded.
Name | Type | Required | Description |
---|---|---|---|
kind |
"Model" |
Yes | A constant, Model . |
frame |
string |
Yes | A string specifying the name of the frame in which the Model is located. |
source |
string |
Yes | A string specifying the name of the Model . |
output |
string |
Yes | A string specifying the name of the Packhunt Text Output or Data Output component in the Grasshopper model that outputs the asset to be downloaded. |
action |
"setButtonSettings" |
Yes | A constant specifying the type of action that will be performed. The only valid option is setButtonSettings . |