diff --git a/packages/react/src/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.tsx b/packages/react/src/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.tsx index 6476b587a7..2fb3881b83 100644 --- a/packages/react/src/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.tsx +++ b/packages/react/src/components/ToggleGroup/ToggleGroupItem/ToggleGroupItem.tsx @@ -4,6 +4,7 @@ import cn from 'classnames'; import { Button } from '../../Button'; import { RovingTabindexItem } from '../../../utility-components/RovingTabIndex'; +import utilityClasses from '../../../utils/utility.module.css'; import classes from './ToggleGroupItem.module.css'; import { useToggleGroupItem } from './useToggleGroupitem'; @@ -13,6 +14,8 @@ export type ToggleGroupItemProps = { value?: string; /** Icon to be displayed on the ToggleGroupItem */ icon?: React.ReactNode; + /** Title for icon when only icons are used */ + iconTitle?: string; /** The text to be displayed on the ToggleGroupItem */ children?: string; } & Omit, 'value' | 'children'>; @@ -21,7 +24,7 @@ export const ToggleGroupItem = forwardRef< HTMLButtonElement, ToggleGroupItemProps >((props, ref) => { - const { children, icon, ...rest } = props; + const { children, icon, iconTitle, ...rest } = props; const { active, size = 'medium', buttonProps } = useToggleGroupItem(props); return ( + {iconTitle && ( + {iconTitle} + )} {children} );