@navinc/base-react-components
Version:
Nav's Pattern Library
27 lines (21 loc) • 812 B
Markdown
Wraps and positions a max number of two tabs created from child elements. Placed at the top of a card to allow users to change the state/view of the card. The active glider state animates to fit the edges of the selected tab.
Create tabs by passing in child `Text` elements to a `SlidingTabs`.
For each child use the `isActive` flag to control the conditions
when active styling should be applied.
#### Usage:
For instance where the URL should not change in the case of a filter,
you can use `isActive` and an `onClick` to change the content of the page.
```
<SlidingTabs>
<Link
isActive={filter === 'summary'}
onClick={setFilter('summary')}>
Summary
</Link>
<Link
isActive={filter === 'full-report'}
onClick={setFilter('full-report')}>
Full Report
</Link>
<SlidingTabs>
```