An open API service indexing awesome lists of open source software.

https://github.com/suhdev/tab-manager


https://github.com/suhdev/tab-manager

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# stickyants-tab-manager

A barebone declarative implementation of a tab-manager.

## Usage

```typescript
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { TabManager, Tab, ActiveTab } from '../index';
import { useSetActiveTab } from '../hooks';

function MySubApp({ children, id, label }) {
const setActiveTab = useSetActiveTab();
return (


{children}
setActiveTab({ id })}>{label}

);
}

function MyTabbedApp() {
return (




Tab 1 content




Tab 2 content



Content for third tab




);
}

(function () {
let el = document.getElementById('app');
if (!el) {
el = document.createElement('div');
el.id = 'app';
document.body.appendChild(el);
}

ReactDOM.render(
,
el,
);

}());

```