Skip to content

Commit

Permalink
fix(MenuItem): Add download to MenuItem (patternfly#9892)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamilto authored Dec 14, 2023
1 parent 6d065fd commit 2afb5fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react-core/src/components/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, '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 */
Expand Down Expand Up @@ -119,6 +121,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
tooltipProps,
rel,
target,
download,
...props
}: MenuItemProps) => {
const {
Expand Down Expand Up @@ -271,7 +274,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
// prevent invalid 'disabled' attribute on <a> tags
disabled: null,
target: isExternalLink ? '_blank' : target,
rel
rel,
download
};
} else if (Component === 'button') {
additionalProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const dropDownItems = (
<DropdownItem value={5} key="separated action">
Separated action
</DropdownItem>
<DropdownItem value={6} key="download" to="#default-link7" download="download.txt">
Download
</DropdownItem>
</DropdownList>
);

Expand Down

0 comments on commit 2afb5fd

Please sign in to comment.