diff --git a/pages/button-dropdown/checkboxes.page.tsx b/pages/button-dropdown/checkboxes.page.tsx index 7fa6b3f99c..51850184eb 100644 --- a/pages/button-dropdown/checkboxes.page.tsx +++ b/pages/button-dropdown/checkboxes.page.tsx @@ -42,6 +42,35 @@ const getItems = (firstChecked: boolean, secondChecked: boolean, thirdChecked: b id: 'id5', text: 'Option without checkbox', }, + { + id: 'id6', + text: 'Disabled option with secondaryText', + secondaryText: 'This is a secondary text', + disabled: true, + }, + { + id: 'id7', + text: 'Option with icon and secondaryText', + iconName: 'gen-ai', + secondaryText: 'This is a secondary text', + }, + { + id: 'id8', + text: 'Option with checkbox, icon, and secondaryText', + iconName: 'gen-ai', + secondaryText: 'This is a secondary text', + checked: thirdChecked, + itemType: 'checkbox', + }, + { + id: 'id8', + text: 'Option with checkbox, icon, labelTag, and secondaryText', + iconName: 'gen-ai', + secondaryText: 'This is a secondary text', + checked: thirdChecked, + itemType: 'checkbox', + labelTag: 'Ctrl + L', + }, ]; return items; }; diff --git a/pages/button-dropdown/disabled-reason.page.tsx b/pages/button-dropdown/disabled-reason.page.tsx index 6f18521693..82864fd812 100644 --- a/pages/button-dropdown/disabled-reason.page.tsx +++ b/pages/button-dropdown/disabled-reason.page.tsx @@ -7,8 +7,13 @@ import { ButtonDropdown, ButtonDropdownProps } from '~components'; import ScreenshotArea from '../utils/screenshot-area'; const actionsItems: ButtonDropdownProps.Items = [ - { id: 'connect', text: 'Connect', disabledReason: 'Instance must be running.', disabled: true }, - { id: 'details', text: 'View details', disabledReason: 'A single instance needs to be selected.', disabled: true }, + { id: 'connect', text: 'Connect', disabledReason: 'Instance must be running.', disabled: true, labelTag: 'Disabled' }, + { + id: 'details', + text: 'View details', + disabledReason: 'A single instance needs to be selected.', + disabled: true, + }, { id: 'manage-state', text: 'Manage instance state', @@ -22,6 +27,7 @@ const actionsItems: ButtonDropdownProps.Items = [ { id: 'auto-scaling', text: 'Attach to Auto Scaling Group', + secondaryText: 'Manage the Instance to Auto Scaling Group', disabledReason: 'Instance must be running and not already be attached to an Auto Scaling Group.', disabled: true, }, @@ -38,6 +44,7 @@ const actionsItems: ButtonDropdownProps.Items = [ text: 'Change shutdown behavior', disabledReason: "Instance can't be a spot instance.", disabled: true, + labelTag: 'Ctrl + D', }, ], }, diff --git a/pages/button-dropdown/events.page.tsx b/pages/button-dropdown/events.page.tsx index ca6655682b..d93031f1be 100644 --- a/pages/button-dropdown/events.page.tsx +++ b/pages/button-dropdown/events.page.tsx @@ -10,19 +10,32 @@ const dropdownItems = [ { text: 'enabled category', items: [ - { id: 'c1long1', text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown' }, - { id: 'c1_disabled_item', text: 'disabled item', disabled: true }, + { + id: 'c1long1', + text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown', + secondaryText: 'Very long option', + }, + { id: 'c1_disabled_item', text: 'disabled item', disabled: true, secondaryText: 'Disabled option' }, { id: 'c1_enabled_item', text: 'option2' }, - { id: 'c1long2', text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown', disabled: true }, - { id: 'c1i3', text: 'option3' }, - { id: 'c1i4', text: 'option4' }, + { + id: 'c1long2', + text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown', + disabled: true, + secondaryText: 'Very long option', + }, + { id: 'c1i3', text: 'option3', secondaryText: 'option 3' }, + { id: 'c1i4', text: 'option4', secondaryText: 'option 4' }, ], }, { text: 'disabled category', disabled: true, items: [ - { id: 'dci1', text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown' }, + { + id: 'dci1', + text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown', + secondaryText: 'Very long option', + }, { id: 'item_in_disabled_category', text: 'option4' }, { id: 'dci5', text: 'option5' }, ], @@ -35,11 +48,13 @@ const dropdownItems = [ id: 'individual_disabled_item', text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown', disabled: true, + labelTag: 'Disabled', }, { id: 'plain_href', text: 'option6', href: '#', + labelTag: 'Link', }, { id: 'plain_href_prevented', diff --git a/pages/button-dropdown/expandable.page.tsx b/pages/button-dropdown/expandable.page.tsx index d2419b159b..c120425cc4 100644 --- a/pages/button-dropdown/expandable.page.tsx +++ b/pages/button-dropdown/expandable.page.tsx @@ -22,11 +22,13 @@ export const items: ButtonDropdownProps['items'] = [ items: [...Array(50)].map((_, index) => ({ id: 'category2Subitem' + index, text: 'Cat 2 Sub item ' + index, + secondaryText: `Option ${index}`, })), }, ...[...Array(10)].map((_, index) => ({ id: 'item' + index, text: 'Item ' + index, + secondaryText: `Option ${index}`, })), { id: 'category3', @@ -45,6 +47,7 @@ export const items: ButtonDropdownProps['items'] = [ { id: 'item10', text: 'Item 10', + secondaryText: 'This is the last option', }, ]; diff --git a/pages/button-dropdown/icon-expandable.page.tsx b/pages/button-dropdown/icon-expandable.page.tsx index 0f133f5c5e..c1acb4ceff 100644 --- a/pages/button-dropdown/icon-expandable.page.tsx +++ b/pages/button-dropdown/icon-expandable.page.tsx @@ -19,6 +19,7 @@ export const items: ButtonDropdownProps['items'] = [ items: [...Array(2)].map((_, index) => ({ id: 'category1Subitem' + index, text: 'Sub item ' + index, + secondaryText: `Option ${index}`, })), }, { @@ -35,6 +36,7 @@ export const items: ButtonDropdownProps['items'] = [ id: 'item1', text: 'Item 1', iconName: 'settings', + secondaryText: 'Option 1', }, { id: 'category3', @@ -50,6 +52,7 @@ export const items: ButtonDropdownProps['items'] = [ items: [...Array(2)].map((_, index) => ({ id: 'category3Subitem' + index, text: 'Sub item ' + index, + labelTag: ' Number ' + index, })), }, ]; diff --git a/pages/button-dropdown/item-element.permutations.page.tsx b/pages/button-dropdown/item-element.permutations.page.tsx index 358caa3b1d..8947aa853f 100644 --- a/pages/button-dropdown/item-element.permutations.page.tsx +++ b/pages/button-dropdown/item-element.permutations.page.tsx @@ -50,6 +50,33 @@ const permutations = createPermutations([ onItemActivate: [() => {}], highlightItem: [() => {}], }, + + // With secondaryText + { + item: [ + { id: '1', text: 'Option', secondaryText: 'This is the first option' }, + { id: '2', text: 'Option 2', secondaryText: 'This is the second option' }, + ], + disabled: [false, true], + highlighted: [false, true], + hasCategoryHeader: [false], + showDivider: [false], + onItemActivate: [() => {}], + highlightItem: [() => {}], + }, + // With labelTag + { + item: [ + { id: '1', text: 'Option', labelTag: 'This is a label tag' }, + { id: '2', text: 'Option 2', secondaryText: 'This is the second option', labelTag: 'This is a label tag' }, + ], + disabled: [false, true], + highlighted: [false, true], + hasCategoryHeader: [false], + showDivider: [false], + onItemActivate: [() => {}], + highlightItem: [() => {}], + }, // With icons { item: [ diff --git a/pages/button-dropdown/main-action.page.tsx b/pages/button-dropdown/main-action.page.tsx index 239e17f0c6..906f7c35fc 100644 --- a/pages/button-dropdown/main-action.page.tsx +++ b/pages/button-dropdown/main-action.page.tsx @@ -22,6 +22,7 @@ export default function ButtonDropdownPage() { { text: 'Launch instance from template', id: 'launch-instance-from-template', + secondaryText: 'Use the existing templates', }, ]} onItemClick={() => setClickedButton('Launch instance from template')} diff --git a/pages/button-dropdown/permutations-main-action.page.tsx b/pages/button-dropdown/permutations-main-action.page.tsx index 279c466054..7a23b4ef8f 100644 --- a/pages/button-dropdown/permutations-main-action.page.tsx +++ b/pages/button-dropdown/permutations-main-action.page.tsx @@ -17,6 +17,7 @@ const launchInstanceItem = { const launchInstanceFromTemplateItem = { text: 'Launch instance from template', iconName: 'file', + secondaryText: 'Use an existing template', } as const; const viewInstancesItem = { diff --git a/pages/button-dropdown/simple.page.tsx b/pages/button-dropdown/simple.page.tsx index 74ae7febab..5ac3a4fcb6 100644 --- a/pages/button-dropdown/simple.page.tsx +++ b/pages/button-dropdown/simple.page.tsx @@ -40,6 +40,22 @@ const items: ButtonDropdownProps['items'] = [ text: 'Option 6', disabled: true, }, + { + id: 'id7', + text: 'Option 7', + secondaryText: 'This is option 7', + }, + { + id: 'id8', + text: 'Option 8', + labelTag: 'Ctrl + 8', + }, + { + id: 'id9', + text: 'Option 9', + secondaryText: 'This is option 9', + labelTag: 'Ctrl + 9', + }, ]; const withNestedOptions: ButtonDropdownProps['items'] = [ @@ -49,10 +65,14 @@ const withNestedOptions: ButtonDropdownProps['items'] = [ { id: '1', text: 'Destroy', + secondaryText: 'This is the Destroy option', + labelTag: 'Ctrl + D', }, { id: '2', text: 'Restart', + secondaryText: 'This is the Restart option', + labelTag: 'Ctrl + R', }, ], }, @@ -77,10 +97,13 @@ const withExpandedGroups: ButtonDropdownProps['items'] = [ { id: 'connect', text: 'Connect', + secondaryText: 'This is the Connect option', + labelTag: 'Ctrl + C', }, { id: 'password', text: 'Get password', + secondaryText: 'This is the Get password option', }, { id: 'states', @@ -103,15 +126,20 @@ const withExpandedGroups: ButtonDropdownProps['items'] = [ { id: 'reboot', text: 'Reboot', + secondaryText: 'This is the Reboot Option', + labelTag: 'Ctrl + B', disabled: true, }, { id: 'terminate', text: 'Terminate', + secondaryText: 'This is the Terminate Option', }, { id: 'external', text: 'Root Page', + secondaryText: '', + labelTag: 'Ctrl + P', external: true, href: '/#/light/', }, diff --git a/pages/button-dropdown/utils/button-dropdown-items.ts b/pages/button-dropdown/utils/button-dropdown-items.ts index 12a9ceb0eb..62acdb4621 100644 --- a/pages/button-dropdown/utils/button-dropdown-items.ts +++ b/pages/button-dropdown/utils/button-dropdown-items.ts @@ -11,10 +11,13 @@ const dropdownItems = [ id: 'id7', text: 'option5', disabled: true, + secondaryText: 'This is a disabled option', + labelTag: 'Disabled', }, { id: 'id8', text: 'VeryLongOptionTextValueHereToTestTheCaseWithThisDropdown', + secondaryText: 'This is the option with a long description, This is the option with a long description', }, { id: 'id9', text: 'option6' }, ]; diff --git a/pages/button-dropdown/word-wrap.page.tsx b/pages/button-dropdown/word-wrap.page.tsx index d12df05739..6041630a51 100644 --- a/pages/button-dropdown/word-wrap.page.tsx +++ b/pages/button-dropdown/word-wrap.page.tsx @@ -14,6 +14,9 @@ const dropdownItems = [ { id: 'id0', text: 'a very long text that may overflow horizontally as in this example that is unnecessarily longer just to exemplify a long text', + secondaryText: + 'A very long text that may overflow horizontally as in this example that is unnecessarily longer just to exemplify a long text', + labelTag: 'Label', }, { id: 'id1', text: 'option1', disabled: true }, { id: 'id2', text: 'option2' }, @@ -28,6 +31,7 @@ const dropdownItems = [ { id: 'id5', text: 'AVeryLongWordThatMayOverflowHorizontallyAsInThisExampleThatIsUnnecessarilyLongerJustToExemplifyALongWord', + labelTag: 'Label', }, { id: 'id6', text: 'option4' }, ], @@ -44,6 +48,7 @@ const dropdownItems = [ { id: 'id9', text: 'option9', + secondaryText: 'This is a disabled option', disabled: true, }, { diff --git a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap index c0c8d4991e..092ffd26c4 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/documenter.test.ts.snap @@ -5632,7 +5632,7 @@ The following properties are supported across all types: - \`lang\` (string) - (Optional) The language of the item, provided as a BCP 47 language tag. - \`disabled\` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible. - \`disabledReason\` (string) - (Optional) Displays text near the \`text\` property when item is disabled. Use to provide additional context. -- \`description\` (string) - additional data that will be passed to a \`data-description\` attribute. +- \`description\` (string) - additional data that will be passed to a \`data-description\` attribute. **Deprecated**, has no effect. - \`ariaLabel\` (string) - (Optional) - ARIA label of the item element. ### action @@ -5645,6 +5645,8 @@ The following properties are supported across all types: - \`iconAlt\` (string) - (Optional) Specifies alternate text for the icon when using \`iconUrl\`. - \`iconUrl\` (string) - (Optional) Specifies the URL of a custom icon. - \`iconSvg\` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the \`svg\` slot of the [icon component](/components/icon/). +- \`secondaryText\` (string) - (Optional) Further information about the action that appears below the label. +- \`labelTag\` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label. ### checkbox @@ -5655,6 +5657,8 @@ When \`type\` is set to "checkbox", the values set to \`href\`, \`external\` and - \`iconAlt\` (string) - (Optional) Specifies alternate text for the icon when using \`iconUrl\`. - \`iconUrl\` (string) - (Optional) Specifies the URL of a custom icon. - \`iconSvg\` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the \`svg\` slot of the [icon component](/components/icon/). +- \`secondaryText\` (string) - (Optional) Further information about the action that appears below the label. +- \`labelTag\` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label. ### group diff --git a/src/button-dropdown/__integ__/button-dropdown-expandable.test.ts b/src/button-dropdown/__integ__/button-dropdown-expandable.test.ts index ff0380d0b5..7576d2915f 100644 --- a/src/button-dropdown/__integ__/button-dropdown-expandable.test.ts +++ b/src/button-dropdown/__integ__/button-dropdown-expandable.test.ts @@ -167,7 +167,7 @@ describe.each([true, false])( await page.setWindowSize(mobileDimensions); await page.focusOnTheTrigger(); await page.keys(['Enter', ...new Array(13).fill('ArrowDown'), 'Enter', 'ArrowDown']); - expect(await page.getFocusedElementText()).toBe('Item 10'); + expect(await page.getFocusedElementText()).toBe('Item 10\nThis is the last option'); }) ); test( @@ -193,7 +193,7 @@ describe.each([true, false])( expect(await page.getFocusedElementText()).toBe('Sub item 1'); // move to the next group, expand it, move one item down await page.keys(['ArrowDown', 'Enter', 'ArrowDown']); - expect(await page.getFocusedElementText()).toBe('Cat 2 Sub item 0'); + expect(await page.getFocusedElementText()).toBe('Cat 2 Sub item 0\nOption 0'); expect(await page.getItemCount('category1Subitem1')).toEqual(0); }) ); @@ -251,7 +251,7 @@ describe.each([true, false])( expect(await page.getItemCount('category2Subitem1')).toEqual(1); await page.keys(['ArrowDown']); expect(await page.getItemCount('category2Subitem2')).toEqual(1); - expect(await page.getFocusedElementText()).toBe('Cat 2 Sub item 1'); + expect(await page.getFocusedElementText()).toBe('Cat 2 Sub item 1\nOption 1'); }) ); test( diff --git a/src/button-dropdown/__integ__/button-dropdown-items.test.ts b/src/button-dropdown/__integ__/button-dropdown-items.test.ts index 534e3fed79..08b5b31f78 100644 --- a/src/button-dropdown/__integ__/button-dropdown-items.test.ts +++ b/src/button-dropdown/__integ__/button-dropdown-items.test.ts @@ -73,7 +73,7 @@ test( await page.openDropdown(); await page.keys('ArrowDown'); - await expect(page.getFocusedElementText()).resolves.toBe('Restart'); - await expect(page.getHighlightedElementText()).resolves.toBe('Restart'); + await expect(page.getFocusedElementText()).resolves.toBe('Restart\nCtrl + R\nThis is the Restart option'); + await expect(page.getHighlightedElementText()).resolves.toBe('Restart\nCtrl + R\nThis is the Restart option'); }) ); diff --git a/src/button-dropdown/__tests__/button-dropdown-items.test.tsx b/src/button-dropdown/__tests__/button-dropdown-items.test.tsx index e5be10a247..2a63587204 100644 --- a/src/button-dropdown/__tests__/button-dropdown-items.test.tsx +++ b/src/button-dropdown/__tests__/button-dropdown-items.test.tsx @@ -498,6 +498,25 @@ describe('Internal ButtonDropdown badge property', () => { wrapper.openDropdown(); expect(wrapper.findAllByClassName(iconStyles.badge)?.map(item => item.getElement())).toHaveLength(2); }); + + it('should render secondaryText and labelTag', () => { + const items = [ + { id: 'i1', text: 'Option 1', secondaryText: 'Description 1', labelTag: 'Ctrl+D 1' }, + { id: 'i2', text: 'Option 2', secondaryText: 'Description 2', labelTag: 'Ctrl+D 2' }, + ]; + const wrapper = renderButtonDropdown({ items }); + wrapper.openDropdown(); + + const item1 = wrapper.findItemById('i1')!; + expect(item1.getElement()).toHaveTextContent('Option 1'); + expect(item1.getElement()).toHaveTextContent('Description 1'); + expect(item1.getElement()).toHaveTextContent('Ctrl+D 1'); + + const item2 = wrapper.findItemById('i2')!; + expect(item2.getElement()).toHaveTextContent('Option 2'); + expect(item2.getElement()).toHaveTextContent('Description 2'); + expect(item2.getElement()).toHaveTextContent('Ctrl+D 2'); + }); }); describe('ButtonDropdown download property', () => { diff --git a/src/button-dropdown/__tests__/button-dropdown-keyboard.test.tsx b/src/button-dropdown/__tests__/button-dropdown-keyboard.test.tsx index f28438c1ff..21273fd46c 100644 --- a/src/button-dropdown/__tests__/button-dropdown-keyboard.test.tsx +++ b/src/button-dropdown/__tests__/button-dropdown-keyboard.test.tsx @@ -45,6 +45,22 @@ const items: ButtonDropdownProps.Items = [ expect(wrapper.findHighlightedItem()!.getElement()).toHaveTextContent('item5'); }); + test('should show secondaryText in highlighted items', () => { + const itemsWithSecondary = [ + { id: 'i1', text: 'item1', secondaryText: 'Description 1' }, + { id: 'i2', text: 'item2' }, + ]; + const testWrapper = renderButtonDropdown({ ...props, items: itemsWithSecondary, onItemClick: onClickSpy }); + testWrapper.openDropdown(); + + const highlighted = testWrapper.findHighlightedItem(); + expect(highlighted).toBeTruthy(); + + const highlightedElement = highlighted!.getElement(); + expect(highlightedElement).toHaveTextContent('item1'); + expect(highlightedElement).toHaveTextContent('Description 1'); + }); + describe('when dropdown is open', () => { beforeEach(() => { act(() => wrapper.findNativeButton().keydown(KeyCode.enter)); diff --git a/src/button-dropdown/interfaces.ts b/src/button-dropdown/interfaces.ts index 9137627683..8fbac60900 100644 --- a/src/button-dropdown/interfaces.ts +++ b/src/button-dropdown/interfaces.ts @@ -27,7 +27,7 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor * - `lang` (string) - (Optional) The language of the item, provided as a BCP 47 language tag. * - `disabled` (boolean) - whether the item is disabled. Disabled items are not clickable, but they can be highlighted with the keyboard to make them accessible. * - `disabledReason` (string) - (Optional) Displays text near the `text` property when item is disabled. Use to provide additional context. - * - `description` (string) - additional data that will be passed to a `data-description` attribute. + * - `description` (string) - additional data that will be passed to a `data-description` attribute. **Deprecated**, has no effect. * - `ariaLabel` (string) - (Optional) - ARIA label of the item element. * * ### action @@ -40,6 +40,8 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`. * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon. * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/). + * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label. + * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label. * * ### checkbox * @@ -50,6 +52,8 @@ export interface ButtonDropdownProps extends BaseComponentProps, ExpandToViewpor * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`. * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon. * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/). + * - `secondaryText` (string) - (Optional) Further information about the action that appears below the label. + * - `labelTag` (string) - (Optional) - A label tag that provides additional guidance, shown next to the label. * * ### group * @@ -185,10 +189,14 @@ export namespace ButtonDropdownProps { itemType?: ItemType; id: string; text: string; + secondaryText?: string; ariaLabel?: string; lang?: string; disabled?: boolean; disabledReason?: string; + /** + * @deprecated Has no effect. + */ description?: string; href?: string; download?: boolean | string; @@ -198,6 +206,7 @@ export namespace ButtonDropdownProps { iconName?: IconProps.Name; iconUrl?: string; iconSvg?: React.ReactNode; + labelTag?: string; } export interface CheckboxItem @@ -206,7 +215,7 @@ export namespace ButtonDropdownProps { checked: boolean; } - export interface ItemGroup extends Omit { + export interface ItemGroup extends Omit { itemType?: 'group'; id?: string; text?: string; diff --git a/src/button-dropdown/item-element/index.tsx b/src/button-dropdown/item-element/index.tsx index 4e49bbbe8d..b2be8c0b20 100644 --- a/src/button-dropdown/item-element/index.tsx +++ b/src/button-dropdown/item-element/index.tsx @@ -140,11 +140,11 @@ function MenuItem({ item, disabled, highlighted, linkStyle }: MenuItemProps) { target={getItemTarget(item)} rel={item.external ? 'noopener noreferrer' : undefined} > - + ) : ( - + ); @@ -160,7 +160,15 @@ function MenuItem({ item, disabled, highlighted, linkStyle }: MenuItemProps) { ); } -const MenuItemContent = ({ item, disabled }: { item: InternalItem | InternalCheckboxItem; disabled: boolean }) => { +const MenuItemContent = ({ + item, + disabled, + highlighted, +}: { + item: InternalItem | InternalCheckboxItem; + disabled: boolean; + highlighted: boolean; +}) => { const hasIcon = !!(item.iconName || item.iconUrl || item.iconSvg); const hasExternal = isLinkItem(item) && item.external; const isCheckbox = isCheckboxItem(item); @@ -176,8 +184,24 @@ const MenuItemContent = ({ item, disabled }: { item: InternalItem | InternalChec badge={item.badge} /> )} - {item.text} - {hasExternal && } +
+
+
+ {item.text} + {hasExternal && } +
+ {item.labelTag && ( +
{item.labelTag}
+ )} +
+ {item.secondaryText && ( +
+ {item.secondaryText} +
+ )} +
); }; diff --git a/src/button-dropdown/item-element/styles.scss b/src/button-dropdown/item-element/styles.scss index 94be68473b..a497c7b57c 100644 --- a/src/button-dropdown/item-element/styles.scss +++ b/src/button-dropdown/item-element/styles.scss @@ -106,3 +106,37 @@ .external-icon { margin-inline-start: awsui.$space-xxs; } + +.content-wrapper { + flex: 1; + display: flex; + flex-direction: column; +} + +.main-row { + display: flex; + justify-content: space-between; + align-items: center; + gap: awsui.$space-s; +} + +.label-tag { + color: awsui.$color-text-body-default; + + &.disabled { + color: awsui.$color-text-interactive-disabled; + } +} + +.secondary-text { + @include styles.font(body-s); + color: awsui.$color-text-dropdown-item-secondary; + + &.highlighted { + color: awsui.$color-text-dropdown-item-highlighted; + } + + &.disabled { + color: awsui.$color-text-interactive-disabled; + } +}