No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Tabs

Tabs are used to organize content by grouping similar information on the same page.

usage
import { Tabs, Item, Header, Content, TabsContext, useTabsContext } from "@sharegate/orbit-ui";
sources
Github

Guidelines

Accessibility

  • An accessible title must be provided through aria-label property.

Usage

We recommend specifying a unique key prop for every <Item>. If you choose to omit the key prop, a key matching the <Item> position will be generated. For example, "0" would be the generated key for the first <Item> of a <Tabs> component without keys.

Default

A default tabs.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Icon

A tab can contain icons.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Lozenge

A tab can contains a lozenge.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Dynamic tabs

Tabs items can be rendered dynamically.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Manually activated tabs

By default, tabs are activated automatically. This means when you use the arrow keys to change tabs, the tab is activated and focused.

The content of a tab should ideally be preloaded. However, if switching to a tab panel causes a network request and possibly a page refresh, there might be some notable latency and this might affect the experience for keyboard and screen reader users.

In this scenario, you should use a manually activated tab, it moves focus without activating the tabs. With focus on a specifc tab, users can activate a tab by pressing Space or Enter.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Async content

A tab can use useTabsContext to load async content when a tab is selected.

Editable example

Orientation

A tabs component can be rendered vertically.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Fluid

A tabs component can split the width of it's container equally between his tabs.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Collapsible

A tabs component can handle horizontal overflow by collapsing the overflowing tabs in a popup.

Mars is a dusty, cold, desert world with a very thin atmosphere. There is strong evidence Mars was—billions of years ago—wetter and warmer, with a thicker atmosphere.
Editable example

Disabled

A tab can be disabled.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

Controlled

The selectedKey state can be handled in controlled mode.

Mars is the fourth planet from the Sun and the second-smallest planet.
Editable example

API

Tabs

usage
import { Tabs } from "@sharegate/orbit-ui";
NameDescriptionDefault
aria-label*
See WCAG.
string
-
autoFocus
Whether or not the first focusable tab should autoFocus on render.
numberfalsetrue
-
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
collapsible
Whether or not the tabs could collapsed to fit into the available space.
falsetrue
true
defaultSelectedKey
The initial value of selectedKey when uncontrolled.
string
-
fluid
Whether or not the tabs take up the width of the container.
false | true | ResponsiveValue<boolean>
-
manual
Whether or not keyboard navigation changes focus between tabs but doens't activate it.
falsetrue
-
onSelectionChange
Called when the selected tab change.
(event: SyntheticEvent<Element, Event>, key: string) => void
eventReact's original event.
keyThe selected tab key.
-
orientation
The orientation of the tabs elements.
"horizontal" | "vertical" | ResponsiveValue<TabsOrientation>
horizontal
selectedKey
A controlled selected key.
string
-

Item

usage
import { Item } from "@sharegate/orbit-ui";
NameDescriptionDefault
children
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
key
A unique key to identify the item.
string
-
usage
import { Header } from "@sharegate/orbit-ui";
slots
"icon", "text", "lozenge"
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
slot
Slot to render into.
string
-

Content

usage
import { Content } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
slot
Slot to render into.
string
-

Tab

usage
import { Tab } from "@sharegate/orbit-ui";
slots
"icon", "text", "lozenge"
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
onSelect*
Called when the tab is selected.
(event: SyntheticEvent<Element, Event>, key: string) => void
-
selected
Whether or not the tab is selected.
falsetrue
-
tab*
Matching tab item.
TabType
-

TabPanel

usage
import { TabPanel } from "@sharegate/orbit-ui";
NameDescriptionDefault
children*
React children.
string | number | false | true | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal
-
panel*
Matching panel item.
PanelType
-