Tabs
This is a pass through component from React-Bootstrap.
See React-Bootstrap for documentation.
Uncontrolled usage
Any Paragon component or export may be added to the code example.
<Tabsvariant="tabs"defaultActiveKey="profile"id="uncontrolled-tab-example"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile">Hello I am the second panel.</Tab><Tab eventKey="contact" title="Contact" disabled>Hello I am third first panel.</Tab></Tabs>
Controlled usage
Any Paragon component or export may be added to the code example.
() => {const [key, setKey] = useState('home');return (<Tabsid="controlled-tab-example"activeKey={key}onSelect={(k) => setKey(k)}><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile">Hello I am the second panel.</Tab><Tab eventKey="contact" title="Contact" disabled>Hello I am third first panel.</Tab></Tabs>);}
Button group usage
Any Paragon component or export may be added to the code example.
<TabsdefaultActiveKey="profile"id="uncontrolled-pills-tab-example"variant="button-group"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile">Hello I am the second panel.</Tab><Tab eventKey="contact" title="Contact" disabled>Hello I am third first panel.</Tab></Tabs>
Pills usage
Any Paragon component or export may be added to the code example.
<TabsdefaultActiveKey="profile"id="uncontrolled-pills-tab-example"variant="pills"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile">Hello I am the second panel.</Tab><Tab eventKey="contact" title="Contact" disabled>Hello I am third first panel.</Tab></Tabs>
Inverse-Pills usage
Any Paragon component or export may be added to the code example.
<Stack className="bg-dark-700 p-4"><Tabsvariant="inverse-pills"defaultActiveKey="profile"id="uncontrolled-pills-tab-example"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile">Hello I am the second panel.</Tab><Tab eventKey="contact" title="Contact" disabled>Hello I am third first panel.</Tab></Tabs></Stack>
Inverse Tabs usage
Any Paragon component or export may be added to the code example.
<Stack className="bg-dark-700 p-4"><Tabsvariant="inverse-tabs"defaultActiveKey="profile"id="uncontrolled-pills-tab-example"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile">Hello I am the second panel.</Tab><Tab eventKey="contact" title="Contact" disabled>Hello I am third first panel.</Tab></Tabs></Stack>
With notification
Any Paragon component or export may be added to the code example.
<Tabs defaultActiveKey="profile" id="tab-example-with-notification"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="profile" title="Profile" notification={1}>Hello I am the second panel.</Tab></Tabs>
With screen reader text in notification
Any Paragon component or export may be added to the code example.
<Tabs defaultActiveKey="profile" id="tab-example-with-sr-notification"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><TabeventKey="profile"title="Profile"notification={(<span>1<span className="sr-only">notification</span></span>)}>Hello I am the second panel.</Tab></Tabs>
Responsive support
Any Paragon component or export may be added to the code example.
<Tabsvariant="tabs"defaultActiveKey="profile"id="uncontrolled-tab-example"><Tab eventKey="home" title="Home">Hello I am the first panel.</Tab><Tab eventKey="dashboard" title="Dashboard">Hello I am the second panel.</Tab><Tab eventKey="profile" title="Profile" notification={1}>Hello I am the third panel.</Tab><Tab eventKey="products" title="Products">Hello I am the fourth panel.</Tab><Tab eventKey="help" title="Help">Hello I am the fifth panel.</Tab><Tab eventKey="about" title="About">Hello I am the sixth panel.</Tab><Tab eventKey="updates" title="Updates">Hello I am the seventh panel.</Tab><Tab eventKey="forum" title="Forum">Hello I am the eighth panel.</Tab><Tab eventKey="job" title="Job">Hello I am the ninth panel.</Tab><Tab eventKey="team" title="Our team">Hello I am the tenth panel.</Tab></Tabs>
Tabs.Deprecated
(Deprecated) basic usage
Any Paragon component or export may be added to the code example.
<Tabs.Deprecatedlabels={['Panel 1','Panel 2','Panel 3']}><div>Hello I am the first panel</div><div>Hello I am the second panel</div><div>Hello I am the third panel</div></Tabs.Deprecated>
Theme Variables (SCSS)#
$tab-notification-height: 1rem !default;$tab-notification-width: 1rem !default;$tab-notification-font-size: $font-size-xs !default;$tab-more-link-dropdown-toggle-padding-x: .7rem !default;$tab-more-link-dropdown-toggle-padding-y: $spacer !default;$tab-more-link-dropdown-toggle-focus-bg: $primary-500 !default;$tab-more-link-dropdown-toggle-focus-border-color: $tab-more-link-dropdown-toggle-focus-bg !default;$tab-more-link-dropdown-toggle-focus-color: $white !default;$tab-more-link-dropdown-toggle-btn-focus-color: $tab-more-link-dropdown-toggle-focus-color !default;$tab-more-link-dropdown-toggle-btn-focus-border-color: $tab-more-link-dropdown-toggle-focus-bg !default;$tab-more-link-dropdown-toggle-active-color: $tab-more-link-dropdown-toggle-focus-color !default;$tab-more-link-dropdown-toggle-hover-color: $tab-more-link-dropdown-toggle-focus-bg !default;$tab-inverse-pills-link-dropdown-toggle-padding-x: .625rem !default;$tab-inverse-pills-link-dropdown-toggle-padding-y: $spacer !default;$tab-inverse-pills-link-dropdown-toggle-focus-bg: $white !default;$tab-inverse-pills-link-dropdown-toggle-focus-color: $primary-500 !default;$tab-inverse-pills-link-dropdown-toggle-active-color: $tab-inverse-pills-link-dropdown-toggle-focus-color !default;$tab-inverse-pills-link-dropdown-toggle-active-hover-color: $tab-inverse-pills-link-dropdown-toggle-focus-bg !default;$tab-inverse-pills-link-dropdown-toggle-active-hover-bg: $primary-300 !default;$tab-inverse-tabs-link-dropdown-toggle-padding-x: .625rem !default;$tab-inverse-tabs-link-dropdown-toggle-padding-y: $spacer !default;$tab-inverse-tabs-link-dropdown-toggle-hover-bg: transparent !default;
Props API#
- labels
node
[]
Requiredspecifies the list of elements that will be displayed within each of the tabbed views. It is the content relevant to each label. Children should not be passed as Props, but should instead be nested between the opening and closing
<Tabs> </Tabs>
tags. - children
element
[]
Requiredspecifies the list of headings that will appear on all of the tabs that will be created.
- title
node
RequiredSpecifies the
Tab
navigation title. - notification
node
Specifies notification bubble content. It appears on the top right of the
Tab
. - disabled
bool
Specifies whether
Tab
is disabled. - eventKey
string
|number
A unique identifier for the Component, the
eventKey
makes it distinguishable from others in a set. Similar to React'skey
prop, in that it only needs to be unique amongst the Components siblings, not globally. - tabClassName
string
Specifies class name to append to the base element.
Usage Insights#
Tab
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.26.3 | 12 | |
frontend-app-authn | 20.36.2 | 6 | |
frontend-app-learner-portal-enterprise | 20.36.0 | 4 | |
frontend-app-learner-portal-programs | 20.28.4 | 1 | |
frontend-app-support-tools | 20.26.0 | 10 | |
prospectus | 20.32.3 | 2 |
Tabs
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 20.26.3 | 5 | |
frontend-app-authn | 20.36.2 | 5 | |
frontend-app-learner-portal-enterprise | 20.36.0 | 1 | |
frontend-app-learner-portal-programs | 20.28.4 | 1 | |
frontend-app-support-tools | 20.26.0 | 3 | |
prospectus | 20.32.3 | 1 |