# Tab Tabs organize related content into separate sections, allowing users to switch between views within the same page without navigating away. They help improve content discoverability, reduce visual clutter, and provide a structured browsing experience. **Category:** Components **Storybook:** https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tab--introduction ## Variants documented in Storybook - HorizontalTabs: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tab--horizontaltabs - InteractiveTabs: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tab--interactivetabs - VerticalTabs: https://doc.ux4g.gov.in/web/?path=/story/ux4g-components-tab--verticaltabs ## Framework setup ### HTML / CDN ```html ``` ### React ```bash npm install ux4g-web-components ``` ```jsx import 'ux4g-web-components/styles.css'; import 'ux4g-web-components/design-system'; ``` ### Angular Update `angular.json`: ```json { "styles": [ "node_modules/ux4g-web-components/styles/ux4g.css", "src/styles.css" ], "scripts": [ "node_modules/ux4g-web-components/dist/runtime/design-system.js" ] } ``` ## Code examples The snippets below are extracted from the Storybook canvas for Tab. Each example shows the rendered HTML, the equivalent React JSX, and the Angular template markup. ### 1. Horizontal Tabs — Horizontal Underline Tabs HTML: ```html
Tabs organize related content into separate sections, allowing users to switch between views within the same page without navigating away. They help improve content discoverability, reduce visual clutter, and provide a structured browsing experience.
Live previews taken directly from the horizontal Tab showcase blocks in src/index.html.
The linked tab-panel demo is preserved as-is from the source showcase.
Live previews taken directly from the vertical Tab showcase blocks in src/index.html.
Classes used by the showcased Tab variants only.
|
Tab container
ux4g-tab
|
|
Tab list wrapper
ux4g-tab-list
|
|
Tab trigger item
ux4g-tab-item
|
|
Tab panel content
ux4g-tab-panel
|
|
Overflow trigger tab
ux4g-tab-more
|
|
Overflow icon wrapper
ux4g-tab-more-icon
|
|
Overflow dropdown list
ux4g-tab-dropdown-list
|
|
Dropdown item with panel target
ux4g-tab-dropdown-item
|
|
Vertical tab layout
ux4g-tab-vertical
|
|
Underline tab style
ux4g-tab-underline
|
|
Pill tab style
ux4g-tab-pill
|
|
Small size
ux4g-tab-sm
|
|
Medium size
ux4g-tab-md
|
|
Large size
ux4g-tab-lg
|
|
Active tab or panel state
is-active
|
Tabs organize related content into separate sections, allowing users to switch between views within the same page without navigating away. They help improve content discoverability, reduce visual clutter, and provide a structured browsing experience.
Live previews taken directly from the horizontal Tab showcase blocks in
src/index.html
.
The linked tab-panel demo is preserved as-is from the source showcase.
Live previews taken directly from the vertical Tab showcase blocks in
src/index.html
.
Classes used by the showcased Tab variants only.
|
Tab container
ux4g-tab
|
|
Tab list wrapper
ux4g-tab-list
|
|
Tab trigger item
ux4g-tab-item
|
|
Tab panel content
ux4g-tab-panel
|
|
Overflow trigger tab
ux4g-tab-more
|
|
Overflow icon wrapper
ux4g-tab-more-icon
|
|
Overflow dropdown list
ux4g-tab-dropdown-list
|
|
Dropdown item with panel target
ux4g-tab-dropdown-item
|
|
Vertical tab layout
ux4g-tab-vertical
|
|
Underline tab style
ux4g-tab-underline
|
|
Pill tab style
ux4g-tab-pill
|
|
Small size
ux4g-tab-sm
|
|
Medium size
ux4g-tab-md
|
|
Large size
ux4g-tab-lg
|
|
Active tab or panel state
is-active
|
Tabs organize related content into separate sections, allowing users to switch between views within the same page without navigating away. They help improve content discoverability, reduce visual clutter, and provide a structured browsing experience.
Live previews taken directly from the horizontal Tab showcase blocks in src/index.html.
The linked tab-panel demo is preserved as-is from the source showcase.
Live previews taken directly from the vertical Tab showcase blocks in src/index.html.
Classes used by the showcased Tab variants only.
|
Tab container
ux4g-tab
|
|
Tab list wrapper
ux4g-tab-list
|
|
Tab trigger item
ux4g-tab-item
|
|
Tab panel content
ux4g-tab-panel
|
|
Overflow trigger tab
ux4g-tab-more
|
|
Overflow icon wrapper
ux4g-tab-more-icon
|
|
Overflow dropdown list
ux4g-tab-dropdown-list
|
|
Dropdown item with panel target
ux4g-tab-dropdown-item
|
|
Vertical tab layout
ux4g-tab-vertical
|
|
Underline tab style
ux4g-tab-underline
|
|
Pill tab style
ux4g-tab-pill
|
|
Small size
ux4g-tab-sm
|
|
Medium size
ux4g-tab-md
|
|
Large size
ux4g-tab-lg
|
|
Active tab or panel state
is-active
|