+ );
+};
+VerticalOverflow.args = {
+ orientation: 'vertical',
+ type: 'default',
+ labels: [
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ],
+};
+VerticalOverflow.argTypes = {
+ type: { options: ['default', 'borderless'] },
+ orientation: { control: { disable: true } },
+ actions: { control: { disable: true } },
+};
+
export const Vertical: Story> = (args) => {
const [index, setIndex] = React.useState(0);
const getContent = () => {
diff --git a/apps/storybook/src/Tabs.test.ts b/apps/storybook/src/Tabs.test.ts
index bbf6e1a93cf..083dcaa515e 100644
--- a/apps/storybook/src/Tabs.test.ts
+++ b/apps/storybook/src/Tabs.test.ts
@@ -10,6 +10,8 @@ describe('Tabs', () => {
'Pill Tabs',
'Sublabels And Icons',
'Vertical',
+ 'Horizontal Overflow',
+ 'Vertical Overflow',
];
tests.forEach((testName) => {
@@ -18,6 +20,18 @@ describe('Tabs', () => {
cy.visit('iframe', { qs: { id } });
cy.wait(1000); // wait for resize observer to be done
cy.compareSnapshot(testName);
+
+ if (testName === 'Horizontal Overflow') {
+ const tabs = cy.get('li > button.iui-tab').should('have.length', 13);
+
+ tabs.last().focus();
+ cy.compareSnapshot(`${testName} (Scroll end)`);
+
+ // cy somehow loses tabs list and does not focus on first element so getting it again.
+ cy.focused().blur();
+ cy.get('li > button.iui-tab').first().focus();
+ cy.compareSnapshot(`${testName} (Scroll start)`);
+ }
});
});
});
diff --git a/apps/website/src/examples/Tabs.overflow.tsx b/apps/website/src/examples/Tabs.overflow.tsx
new file mode 100644
index 00000000000..e7015664ac8
--- /dev/null
+++ b/apps/website/src/examples/Tabs.overflow.tsx
@@ -0,0 +1,53 @@
+/*---------------------------------------------------------------------------------------------
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
+ * See LICENSE.md in the project root for license terms and full copyright notice.
+ *--------------------------------------------------------------------------------------------*/
+import * as React from 'react';
+import { Tabs, Tab } from '@itwin/itwinui-react';
+
+export default () => {
+ const [index, setIndex] = React.useState(0);
+ const getContent = () => {
+ switch (index) {
+ case 0:
+ return 'Bentley Systems, Incorporated, is an American-based software development company that develops, manufactures, licenses, sells and supports computer software and services for the design, construction, and operation of infrastructure.';
+ case 1:
+ return "The company's software serves the building, plant, civil, and geospatial markets in the areas of architecture, engineering, construction (AEC) and operations.";
+ case 2:
+ return 'Their software products are used to design, engineer, build, and operate large constructed assets such as roadways, railways, bridges, buildings, industrial plants, power plants, and utility networks.';
+ case 3:
+ return 'The company re-invests 20% of their revenues in research and development.';
+ case 4:
+ return 'Bentley Systems is headquartered in Exton, Pennsylvania, United States, but has development, sales and other departments in over 50 countries.';
+ case 5:
+ return 'The company had revenues of $700 million in 2018.';
+ case 6:
+ return 'Keith A. Bentley and Barry J. Bentley founded Bentley Systems in 1984.';
+ default:
+ return 'They introduced the commercial version of PseudoStation in 1985, which allowed users of Intergraphs VAX systems to use low-cost graphics terminals to view and modify the designs on their Intergraph IGDS (Interactive Graphics Design System) installations.';
+ }
+ };
+ const labels = [
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ];
+
+ return (
+
+
+ {getContent()}
+
+
+ );
+};
diff --git a/apps/website/src/examples/index.tsx b/apps/website/src/examples/index.tsx
index 4d74e49eeda..a940e269595 100644
--- a/apps/website/src/examples/index.tsx
+++ b/apps/website/src/examples/index.tsx
@@ -209,6 +209,7 @@ export { default as SurfaceNoPaddingExample } from './Surface.nopadding';
export { default as TableMainExample } from './Table.main';
export { default as TabsMainExample } from './Tabs.main';
+export { default as TabsOverflowExample } from './Tabs.overflow';
export { default as TagMainExample } from './Tag.main';
export { default as TagBasicExample } from './Tag.basic';
diff --git a/apps/website/src/pages/docs/tabs.mdx b/apps/website/src/pages/docs/tabs.mdx
index 1952684c595..8f53d8b33fe 100644
--- a/apps/website/src/pages/docs/tabs.mdx
+++ b/apps/website/src/pages/docs/tabs.mdx
@@ -20,6 +20,16 @@ import * as AllExamples from '~/examples';
+## Usage
+
+### Overflow
+
+If the available space does not allow all the tabs to be displayed, set `useOverflow` of `OverflowOptions` to true. This allows tabs to be scrollable.
+
+
+
+
+
## Props
diff --git a/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_dark_0_demo-overflow_0_.png b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_dark_0_demo-overflow_0_.png
new file mode 100644
index 00000000000..9c2284f116f
Binary files /dev/null and b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_dark_0_demo-overflow_0_.png differ
diff --git a/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_hc_dark_0_demo-overflow_0_.png b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_hc_dark_0_demo-overflow_0_.png
new file mode 100644
index 00000000000..bba717ad116
Binary files /dev/null and b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_hc_dark_0_demo-overflow_0_.png differ
diff --git a/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_hc_light_0_demo-overflow_0_.png b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_hc_light_0_demo-overflow_0_.png
new file mode 100644
index 00000000000..f3809a3e544
Binary files /dev/null and b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_hc_light_0_demo-overflow_0_.png differ
diff --git a/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_light_0_demo-overflow_0_.png b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_light_0_demo-overflow_0_.png
new file mode 100644
index 00000000000..dcf189fbe84
Binary files /dev/null and b/packages/itwinui-css/backstop/results/bitmaps_reference/iTwinUI_tabs_Type_Overflow_light_0_demo-overflow_0_.png differ
diff --git a/packages/itwinui-css/backstop/scenarios/tabs.js b/packages/itwinui-css/backstop/scenarios/tabs.js
index ee687c1e12a..30a5c2c755b 100644
--- a/packages/itwinui-css/backstop/scenarios/tabs.js
+++ b/packages/itwinui-css/backstop/scenarios/tabs.js
@@ -14,6 +14,10 @@ module.exports = [
selectors: ['#demo-default-vertical'],
viewports: [{ width: 800, height: 600 }],
}),
+ scenario('Type Overflow', {
+ selectors: ['#demo-overflow'],
+ viewports: [{ width: 800, height: 600 }],
+ }),
scenario('Type borderless', {
selectors: ['#demo-borderless'],
viewports: [{ width: 800, height: 600 }],
diff --git a/packages/itwinui-css/backstop/tests/tabs.html b/packages/itwinui-css/backstop/tests/tabs.html
index 08d107df2a2..28bc03e362a 100644
--- a/packages/itwinui-css/backstop/tests/tabs.html
+++ b/packages/itwinui-css/backstop/tests/tabs.html
@@ -29,6 +29,9 @@
#demo-borderless-vertical {
width: auto;
}
+ #demo-overflow-vertical{
+ height: 250px;
+ }
@@ -842,6 +845,374 @@
Default
+
Overflow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
+ cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
+ est laborum.
+
+
+ This is the left tab's content.
+
+
+ This is the none tab's content.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+ tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+ veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+ commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
+ velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
+ cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
+ est laborum.
+