(props: MultiComboboxPro
/>
+ {isClearable && selectedItems.length > 0 && (
+ {
+ e.stopPropagation();
+ reset();
+ }}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ reset();
+ }
+ }}
+ />
+ )}
diff --git a/packages/grafana-ui/src/components/Combobox/getMultiComboboxStyles.ts b/packages/grafana-ui/src/components/Combobox/getMultiComboboxStyles.ts
index 06bd2dd2a22..3b330240995 100644
--- a/packages/grafana-ui/src/components/Combobox/getMultiComboboxStyles.ts
+++ b/packages/grafana-ui/src/components/Combobox/getMultiComboboxStyles.ts
@@ -12,7 +12,8 @@ export const getMultiComboboxStyles = (
disabled?: boolean,
width?: number | 'auto',
minWidth?: number,
- maxWidth?: number
+ maxWidth?: number,
+ isClearable?: boolean
) => {
const inputStyles = getInputStyles({ theme, invalid });
const focusStyles = getFocusStyles(theme);
@@ -35,7 +36,7 @@ export const getMultiComboboxStyles = (
width: '100%',
gap: theme.spacing(0.5),
padding: theme.spacing(0.5),
- paddingRight: 28, // Account for suffix
+ paddingRight: isClearable ? theme.spacing(5) : 28, // Account for suffix
'&:focus-within': {
...focusStyles,
},
diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json
index 3b6111cb266..6f9cda10abe 100644
--- a/public/locales/en-US/grafana.json
+++ b/public/locales/en-US/grafana.json
@@ -2072,6 +2072,9 @@
"all": {
"title": "All",
"title-filtered": "All (filtered)"
+ },
+ "clear": {
+ "title": "Clear all"
}
},
"nav": {
diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json
index f04a543f927..6b3f2d081a7 100644
--- a/public/locales/pseudo-LOCALE/grafana.json
+++ b/public/locales/pseudo-LOCALE/grafana.json
@@ -2072,6 +2072,9 @@
"all": {
"title": "Åľľ",
"title-filtered": "Åľľ (ƒįľŧęřęđ)"
+ },
+ "clear": {
+ "title": "Cľęäř äľľ"
}
},
"nav": {