diff --git a/packages/react-core/src/components/ToggleGroup/ToggleGroupItem.tsx b/packages/react-core/src/components/ToggleGroup/ToggleGroupItem.tsx index b2c5e79b3a3..81e00ff5d23 100644 --- a/packages/react-core/src/components/ToggleGroup/ToggleGroupItem.tsx +++ b/packages/react-core/src/components/ToggleGroup/ToggleGroupItem.tsx @@ -8,6 +8,8 @@ export interface ToggleGroupItemProps extends Omit = ({ text, icon, + iconPosition = 'start', className, isDisabled = false, isSelected = false, @@ -42,6 +45,8 @@ export const ToggleGroupItem: React.FunctionComponent = ({ console.warn('An accessible aria-label is required when using the toggle group item icon variant.'); } + const toggleGroupIcon = {icon}; + return (
); diff --git a/packages/react-core/src/components/ToggleGroup/examples/ToggleGroupTextIcon.tsx b/packages/react-core/src/components/ToggleGroup/examples/ToggleGroupTextIcon.tsx index f3e6c61868e..147290697c9 100644 --- a/packages/react-core/src/components/ToggleGroup/examples/ToggleGroupTextIcon.tsx +++ b/packages/react-core/src/components/ToggleGroup/examples/ToggleGroupTextIcon.tsx @@ -15,28 +15,57 @@ export const ToggleGroupIcon: React.FunctionComponent = () => { setIsSelected((prevIsSelected) => ({ ...prevIsSelected, [id]: isSelected })); }; return ( - - } - text="Copy" - buttonId="toggle-group-text-icons-1" - isSelected={isSelected['toggle-group-text-icons-1']} - onChange={handleItemClick} - /> - } - text="Undo" - buttonId="toggle-group-text-icons-2" - isSelected={isSelected['toggle-group-text-icons-2']} - onChange={handleItemClick} - /> - } - text="Share" - buttonId="toggle-group-text-icons-3" - isSelected={isSelected['toggle-group-text-icons-3']} - onChange={handleItemClick} - /> - + <> + + } + text="Copy" + buttonId="toggle-group-text-icons-1" + isSelected={isSelected['toggle-group-text-icons-1']} + onChange={handleItemClick} + /> + } + text="Undo" + buttonId="toggle-group-text-icons-2" + isSelected={isSelected['toggle-group-text-icons-2']} + onChange={handleItemClick} + /> + } + text="Share" + buttonId="toggle-group-text-icons-3" + isSelected={isSelected['toggle-group-text-icons-3']} + onChange={handleItemClick} + /> + +
+ + } + iconPosition="end" + text="Copy" + buttonId="toggle-group-text-icons-4" + isSelected={isSelected['toggle-group-text-icons-4']} + onChange={handleItemClick} + /> + } + iconPosition="end" + text="Undo" + buttonId="toggle-group-text-icons-5" + isSelected={isSelected['toggle-group-text-icons-5']} + onChange={handleItemClick} + /> + } + iconPosition="end" + text="Share" + buttonId="toggle-group-text-icons-6" + isSelected={isSelected['toggle-group-text-icons-6']} + onChange={handleItemClick} + /> + + ); };