Skip to content

Commit 2afb5fd

Browse files
authored
fix(MenuItem): Add download to MenuItem (#9892)
1 parent 6d065fd commit 2afb5fd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/react-core/src/components/Menu/MenuItem.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
2929
target?: string;
3030
/** Navigation link relationship. Only set when the to property is present. */
3131
rel?: string;
32+
/** Navigation link download. Only set when the to property is present. */
33+
download?: string;
3234
/** Flag indicating the item has a checkbox */
3335
hasCheckbox?: boolean;
3436
/** Flag indicating whether the item is active */
@@ -119,6 +121,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
119121
tooltipProps,
120122
rel,
121123
target,
124+
download,
122125
...props
123126
}: MenuItemProps) => {
124127
const {
@@ -271,7 +274,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
271274
// prevent invalid 'disabled' attribute on <a> tags
272275
disabled: null,
273276
target: isExternalLink ? '_blank' : target,
274-
rel
277+
rel,
278+
download
275279
};
276280
} else if (Component === 'button') {
277281
additionalProps = {

packages/react-integration/demo-app-ts/src/components/demos/DropdownDemo/DropdownDemo.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const dropDownItems = (
2828
<DropdownItem value={5} key="separated action">
2929
Separated action
3030
</DropdownItem>
31+
<DropdownItem value={6} key="download" to="#default-link7" download="download.txt">
32+
Download
33+
</DropdownItem>
3134
</DropdownList>
3235
);
3336

0 commit comments

Comments
 (0)