From 2afb5fdeb8ade43aee6dadaccf9067a0939212c7 Mon Sep 17 00:00:00 2001 From: Robb Hamilton Date: Thu, 14 Dec 2023 11:17:35 -0500 Subject: [PATCH] fix(MenuItem): Add download to MenuItem (#9892) --- packages/react-core/src/components/Menu/MenuItem.tsx | 6 +++++- .../src/components/demos/DropdownDemo/DropdownDemo.tsx | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/react-core/src/components/Menu/MenuItem.tsx b/packages/react-core/src/components/Menu/MenuItem.tsx index c3deae335bf..b5110dec4d2 100644 --- a/packages/react-core/src/components/Menu/MenuItem.tsx +++ b/packages/react-core/src/components/Menu/MenuItem.tsx @@ -29,6 +29,8 @@ export interface MenuItemProps extends Omit, 'onC target?: string; /** Navigation link relationship. Only set when the to property is present. */ rel?: string; + /** Navigation link download. Only set when the to property is present. */ + download?: string; /** Flag indicating the item has a checkbox */ hasCheckbox?: boolean; /** Flag indicating whether the item is active */ @@ -119,6 +121,7 @@ const MenuItemBase: React.FunctionComponent = ({ tooltipProps, rel, target, + download, ...props }: MenuItemProps) => { const { @@ -271,7 +274,8 @@ const MenuItemBase: React.FunctionComponent = ({ // prevent invalid 'disabled' attribute on tags disabled: null, target: isExternalLink ? '_blank' : target, - rel + rel, + download }; } else if (Component === 'button') { additionalProps = { diff --git a/packages/react-integration/demo-app-ts/src/components/demos/DropdownDemo/DropdownDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/DropdownDemo/DropdownDemo.tsx index e90080ea3c8..0233ce4c467 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/DropdownDemo/DropdownDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/DropdownDemo/DropdownDemo.tsx @@ -28,6 +28,9 @@ const dropDownItems = ( Separated action + + Download + );