Skip to content

Commit b0d2cfe

Browse files
committed
fix(tabs): select the first tab instead of throwing an error
1 parent 8ad9ef9 commit b0d2cfe

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

demo/TabsExamples.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function TabsExamples() {
2525
{ title: 'C', content: 'c' },
2626
]}
2727
bordered={true}
28+
activeTab={4}
2829
/>
2930
</div>
3031
</div>

src/tabs/Tabs.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { TabContent } from './TabContent';
55

66
export function Tabs({ vertical, tabs, activeTab, onlyRenderActiveTab, bordered, onSelect }) {
77
if (activeTab >= tabs.length) {
8-
throw new Error(`Invalid tab selected: ${activeTab}`);
8+
// eslint-disable-next-line no-console
9+
console.error(`Invalid tab selected: ${activeTab}`);
10+
activeTab = 0;
911
}
1012

1113
return (

0 commit comments

Comments
 (0)