File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ const Button = props => {
22
22
n_clicks,
23
23
target,
24
24
type,
25
+ download,
25
26
...otherProps
26
27
} = props ;
27
28
@@ -43,6 +44,7 @@ const Button = props => {
43
44
target = { useLink ? target : null }
44
45
href = { disabled ? null : href }
45
46
disabled = { disabled }
47
+ download = { useLink ? download : null }
46
48
{ ...omit ( [ 'n_clicks_timestamp' ] , otherProps ) }
47
49
data-dash-is-loading = {
48
50
( loading_state && loading_state . is_loading ) || undefined
@@ -186,7 +188,12 @@ Button.propTypes = {
186
188
* The default behavior of the button. Possible values are: button, reset,
187
189
* submit
188
190
*/
189
- type : PropTypes . oneOf ( [ 'button' , 'reset' , 'submit' ] )
191
+ type : PropTypes . oneOf ( [ 'button' , 'reset' , 'submit' ] ) ,
192
+
193
+ /**
194
+ * Indicates that the hyperlink is to be used for downloading a resource.
195
+ */
196
+ download : PropTypes . string
190
197
} ;
191
198
192
199
export default Button ;
Original file line number Diff line number Diff line change @@ -68,8 +68,10 @@ class Link extends Component {
68
68
preOnClick,
69
69
target,
70
70
href,
71
+ download,
71
72
...otherProps
72
73
} = this . props ;
74
+ const linkIsExternal = href && isExternalLink ( external_link , href ) ;
73
75
/**
74
76
* ideally, we would use cloneElement however
75
77
* that doesn't work with dash's recursive
@@ -78,7 +80,8 @@ class Link extends Component {
78
80
return (
79
81
< a
80
82
href = { href }
81
- target = { href && isExternalLink ( external_link , href ) ? target : null }
83
+ target = { linkIsExternal ? target : null }
84
+ download = { download && linkIsExternal ? download : null }
82
85
{ ...otherProps }
83
86
onClick = { e => this . updateLocation ( e ) }
84
87
>
@@ -136,7 +139,9 @@ Link.propTypes = {
136
139
*/
137
140
preOnClick : PropTypes . func ,
138
141
139
- target : PropTypes . string
142
+ target : PropTypes . string ,
143
+
144
+ download : PropTypes . string
140
145
} ;
141
146
142
147
Link . defaultProps = {
You can’t perform that action at this time.
0 commit comments