diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index 262754c98087..9eaeaf9a64fa 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -7482,6 +7482,9 @@ Map { "handleSwitcherItemFocus": Object { "type": "func", }, + "href": Object { + "type": "string", + }, "index": Object { "type": "number", }, diff --git a/packages/react/src/components/UIShell/SwitcherItem.tsx b/packages/react/src/components/UIShell/SwitcherItem.tsx index 90f303c73ade..06354fb7151e 100644 --- a/packages/react/src/components/UIShell/SwitcherItem.tsx +++ b/packages/react/src/components/UIShell/SwitcherItem.tsx @@ -46,6 +46,10 @@ interface BaseSwitcherItemProps { * Specify whether the panel is selected */ isSelected?: boolean; + /** + * Optionally provide an href for the underlying li` + */ + href?: string; } interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps { @@ -75,6 +79,7 @@ const SwitcherItem = forwardRef( index, handleSwitcherItemFocus, onKeyDown = () => {}, + href, ...rest } = props; @@ -116,6 +121,7 @@ const SwitcherItem = forwardRef( setTabFocus(evt); onKeyDown(evt); }} + href={href} ref={forwardRef} {...rest} className={linkClassName} @@ -143,6 +149,10 @@ SwitcherItem.propTypes = { * event handlers */ handleSwitcherItemFocus: PropTypes.func, + /** + * Optionally provide an href for the underlying li` + */ + href: PropTypes.string, /** * Specify the index of the SwitcherItem */