Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new variant added for tabs #6623

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { BsPrefixProps, BsPrefixRefForwardingComponent } from './helpers';
export interface NavProps extends BsPrefixProps, BaseNavProps {
navbarBsPrefix?: string;
cardHeaderBsPrefix?: string;
variant?: 'tabs' | 'pills' | string;
variant?: 'tabs' | 'pills' | 'underline' | string;
defaultActiveKey?: EventKey;
fill?: boolean;
justify?: boolean;
Expand All @@ -39,7 +39,7 @@ const propTypes = {
/**
* The visual variant of the nav items.
*
* @type {('tabs'|'pills')}
* @type {('tabs'| 'pills' | 'underline')}
*/
variant: PropTypes.string,

Expand Down
2 changes: 1 addition & 1 deletion src/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const propTypes = {
/**
* Navigation style
*
* @type {('tabs'| 'pills')}
* @type {('tabs'| 'pills' | 'underline')}
*/
variant: PropTypes.string,

Expand Down
11 changes: 10 additions & 1 deletion www/docs/components/tabs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ sidebar_label: Tabs

import TabsControlled from '!!raw-loader!../examples/Tabs/Controlled';
import LeftTabs from '!!raw-loader!../examples/Tabs/LeftTabs';
import Underline from '!!raw-loader!../examples/Tabs/Underline';
import TabsNoAnimation from '!!raw-loader!../examples/Tabs/NoAnimation';
import TabsUncontrolled from '!!raw-loader!../examples/Tabs/Uncontrolled';
import TabsFill from '!!raw-loader!../examples/Tabs/Fill';
Expand Down Expand Up @@ -81,12 +82,20 @@ Create a set of NavItems each with an `eventKey`
corresponding to the eventKey of a `TabPane`. Wrap the whole
thing in a `TabContainer` and you have fully functioning
custom tabs component. Check out the below example making use of the
grid system and pills.
grid system, pills and underline.

## Pills

<CodeBlock language="jsx" live previewClassName="bs-example-tabs">
{LeftTabs}
</CodeBlock>

## Underline

<CodeBlock language="jsx" live previewClassName="bs-example-tabs">
{Underline}
</CodeBlock>

## API

### Tabs
Expand Down
31 changes: 31 additions & 0 deletions www/docs/examples/Tabs/Underline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import Col from 'react-bootstrap/Col';
import Nav from 'react-bootstrap/Nav';
import Row from 'react-bootstrap/Row';
import Tab from 'react-bootstrap/Tab';

function UnderlineExample() {
return (
<Tab.Container id="left-tabs-example" defaultActiveKey="first">
<Row>
<Col sm={3}>
<Nav variant="underline" className="flex-column">
<Nav.Item>
<Nav.Link eventKey="first">Tab 1</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link eventKey="second">Tab 2</Nav.Link>
</Nav.Item>
</Nav>
</Col>
<Col sm={9}>
<Tab.Content>
<Tab.Pane eventKey="first">First tab content</Tab.Pane>
<Tab.Pane eventKey="second">Second tab content</Tab.Pane>
</Tab.Content>
</Col>
</Row>
</Tab.Container>
);
}

export default UnderlineExample;