diff --git a/src/components/Table/README.md b/src/components/Table/README.md
index c7ccb1cbe5..19dbca2b00 100644
--- a/src/components/Table/README.md
+++ b/src/components/Table/README.md
@@ -84,12 +84,15 @@ type TableActionConfig = TableAction | TableActionGroup;
#### TableAction
-| Name | Description | Type | Default |
-| :------- | :-------------- | :----------------------------------: | :--------: |
-| text | Text | `string` | |
-| handler | Click handler | `(item: any, index: number) => void` | |
-| disabled | Action disabled | `boolean ` | |
-| theme | Theme | `"normal"` `"danger"` | `"normal"` |
+| Name | Description | Type | Default |
+| :------- | :----------------------------------------------------------------- | :----------------------------------: | :--------: |
+| text | Text | `string` | |
+| handler | Click handler | `(item: any, index: number) => void` | |
+| disabled | Action disabled | `boolean` | |
+| href | Menu item with this prop becomes a link to the specified location. | `string` | |
+| target | Same as the `target` attribute of the `` tag. | `string` | |
+| rel | Same as the `rel` attribute of the `` tag. | `string` | |
+| theme | Theme | `"normal"` `"danger"` | `"normal"` |
#### TableActionGroup
diff --git a/src/components/Table/__stories__/Table.stories.tsx b/src/components/Table/__stories__/Table.stories.tsx
index 6cbdb95bae..762032e99e 100644
--- a/src/components/Table/__stories__/Table.stories.tsx
+++ b/src/components/Table/__stories__/Table.stories.tsx
@@ -118,6 +118,14 @@ const WithTableActionsTemplate: StoryFn> = (args) => {
action('danger')(handlerArgs);
},
},
+ {
+ text: 'with href',
+ theme: 'normal',
+ href: 'https://cloud.yandex.com',
+ target: '_blank',
+ rel: 'noopener noreferrer',
+ handler: () => {},
+ },
];
return ;
};
diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx
index 3fdbdf364e..017902104e 100644
--- a/src/components/Table/hoc/withTableActions/withTableActions.tsx
+++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx
@@ -44,6 +44,9 @@ export interface TableAction {
index: number,
event: React.MouseEvent,
) => void;
+ href?: string;
+ target?: string;
+ rel?: string;
disabled?: boolean;
theme?: MenuItemProps['theme'];
icon?: MenuItemProps['iconStart'];
@@ -174,16 +177,17 @@ export function withTableActions(
);
} else {
+ const {text, icon, handler, ...restProps} = action;
+
return (
- {action.text}
+ {text}
);
}
@@ -204,11 +208,12 @@ export function withTableActions(
};
private handleActionClick = (
- action: TableAction,
+ handler: TableAction['handler'],
data: PopupData,
event: React.MouseEvent,
) => {
- action.handler(data.item, data.index, event);
+ handler(data.item, data.index, event);
+
this.closePopup();
};