Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add download to MenuItem #9892

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading