Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/jeetiss/tabs

React tabs with hooks
https://github.com/jeetiss/tabs

hooks react tabs

Last synced: about 1 month ago
JSON representation

React tabs with hooks

Awesome Lists containing this project

README

        

# @bumaga/tabs

Headless tabs component for React

## Features

- 📦 super small, 381 B vs 3.5kB [react-tabs](https://github.com/reactjs/react-tabs)
- 🚫 no styles, just logic. Style what you want, as you want
- 🎣 components and hooks API

## Install

```
npm install @bumaga/tabs
```

```
yarn add @bumaga/tabs
```

## Usage

### With components

```jsx
import React from 'react'
import { Tabs, Tab, Panel } from '@bumaga/tabs'

export default () => (


Tab 1
Tab 2
Tab 3

Panel 1


Panel 2


panel 3



);
```

### With hooks

```jsx
import React from "react";
import { Tabs, useTabState, usePanelState } from "@bumaga/tabs";

const Tab = ({ children }) => {
const { onClick } = useTabState();

return {children};
};

const Panel = ({ children }) => {
const isActive = usePanelState();

return isActive ?

{children}

: null;
};

export default () => (


Tab 1
Tab 2

Panel 1
Panel 2

);
```