https://github.com/suhdev/tab-manager
https://github.com/suhdev/tab-manager
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/suhdev/tab-manager
- Owner: suhdev
- Created: 2019-08-13T17:05:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T07:11:08.000Z (over 3 years ago)
- Last Synced: 2025-02-08T20:13:43.334Z (over 1 year ago)
- Language: TypeScript
- Size: 777 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
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,
);
}());
```