Skip to content

Commit 9830f7a

Browse files
committed
feat(Tabs): Remove icon prop
1 parent 74a47ab commit 9830f7a

File tree

3 files changed

+17
-32
lines changed

3 files changed

+17
-32
lines changed

packages/react/src/components/Tabs/Tab/Tab.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ import { useTabItem } from './useTab';
1010
export type TabProps = {
1111
/** Value that will be set in the `Tabs` components state when the tab is activated*/
1212
value: string;
13-
/** Icon to display
14-
* @deprecated This will be removed in the future, icons will be passed as children
15-
*/
16-
icon?: React.ReactNode;
1713
} & Omit<HTMLAttributes<HTMLButtonElement>, 'value'>;
1814

1915
export const Tab = forwardRef<HTMLButtonElement, TabProps>((props, ref) => {
2016
const { children, className, ...rest } = props;
21-
const { active, size = 'medium', icon, ...useTabRest } = useTabItem(props);
17+
const { active, size = 'medium', ...useTabRest } = useTabItem(props);
2218

2319
return (
2420
<RovingTabindexItem
@@ -33,7 +29,6 @@ export const Tab = forwardRef<HTMLButtonElement, TabProps>((props, ref) => {
3329
ref={ref}
3430
{...rest}
3531
>
36-
{icon}
3732
{children}
3833
</RovingTabindexItem>
3934
);

packages/react/src/components/Tabs/Tab/useTab.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ type UseTab = (props: TabProps) => {
1111
} & Pick<
1212
HTMLAttributes<HTMLButtonElement>,
1313
'id' | 'aria-selected' | 'role' | 'onClick'
14-
> &
15-
Pick<TabProps, 'icon'>;
14+
>;
1615

1716
/** Handles props for `Tab` in context with `Tabs` */
1817
export const useTabItem: UseTab = (props: TabProps) => {

packages/react/src/components/Tabs/Tabs.stories.tsx

+15-24
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,15 @@ Preview.args = {
5252
export const IconsOnly: StoryFn<typeof Tabs> = () => (
5353
<Tabs defaultValue='value1'>
5454
<Tabs.List>
55-
<Tabs.Tab
56-
value='value1'
57-
icon={<AkselIcon title='Airplane' />}
58-
/>
59-
<Tabs.Tab
60-
value='value2'
61-
icon={<AkselIcon2 title='Newspaper' />}
62-
/>
63-
<Tabs.Tab
64-
value='value3'
65-
icon={<AkselIcon3 title='Dog' />}
66-
/>
55+
<Tabs.Tab value='value1'>
56+
<AkselIcon title='Airplane' />
57+
</Tabs.Tab>
58+
<Tabs.Tab value='value2'>
59+
<AkselIcon2 title='Newspaper' />
60+
</Tabs.Tab>
61+
<Tabs.Tab value='value3'>
62+
<AkselIcon3 title='Dog' />
63+
</Tabs.Tab>
6764
</Tabs.List>
6865
<Tabs.Content value='value1'>content 1</Tabs.Content>
6966
<Tabs.Content value='value2'>content 2</Tabs.Content>
@@ -88,22 +85,16 @@ export const Controlled: StoryFn<typeof Tabs> = () => {
8885
onChange={setValue}
8986
>
9087
<Tabs.List>
91-
<Tabs.Tab
92-
value='value1'
93-
icon={icon}
94-
>
88+
<Tabs.Tab value='value1'>
89+
{icon}
9590
Tab 1
9691
</Tabs.Tab>
97-
<Tabs.Tab
98-
value='value2'
99-
icon={<AkselIcon2 />}
100-
>
92+
<Tabs.Tab value='value2'>
93+
<AkselIcon2 />
10194
Tab 2
10295
</Tabs.Tab>
103-
<Tabs.Tab
104-
value='value3'
105-
icon={<AkselIcon4 />}
106-
>
96+
<Tabs.Tab value='value3'>
97+
<AkselIcon4 />
10798
Tab 3
10899
</Tabs.Tab>
109100
</Tabs.List>

0 commit comments

Comments
 (0)