Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Merri/react-tabbordion
Universal, semantic and CSS-only supporting React state managing components for creating Accordions and Tabs
https://github.com/Merri/react-tabbordion
accessibility accordion react react-component react-components reactjs tabs
Last synced: about 2 months ago
JSON representation
Universal, semantic and CSS-only supporting React state managing components for creating Accordions and Tabs
- Host: GitHub
- URL: https://github.com/Merri/react-tabbordion
- Owner: Merri
- License: mit
- Created: 2015-06-24T19:32:18.000Z (over 9 years ago)
- Default Branch: v1
- Last Pushed: 2023-01-06T01:33:58.000Z (almost 2 years ago)
- Last Synced: 2024-10-25T11:51:59.124Z (about 2 months ago)
- Topics: accessibility, accordion, react, react-component, react-components, reactjs, tabs
- Language: JavaScript
- Homepage: https://merri.github.io/react-tabbordion/
- Size: 1.5 MB
- Stars: 80
- Watchers: 3
- Forks: 11
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-components - react-tabbordion - [demo](https://merri.github.io/react-tabbordion) - Universal, semantic and CSS-only components for creating Accordions and Tabs. (UI Components / Collapse)
- awesome-react - react-tabbordion - [demo](https://merri.github.io/react-tabbordion) - Tabbordion is a component for managing active state between multiple items. You can make anything out of it: Tabs component, Accordion component, Multi select list component,Option component, List of options, List of checkboxes. ![](https://img.shields.io/github/stars/Merri/react-tabbordion.svg?style=social&label=Star) (UI Components / Collapse)
- awesome-react-components - react-tabbordion - [demo](https://merri.github.io/react-tabbordion) - Universal, semantic and CSS-only components for creating Accordions and Tabs. (UI Components / Collapse)
- fucking-awesome-react-components - react-tabbordion - 🌎 [demo](merri.github.io/react-tabbordion) - Universal, semantic and CSS-only components for creating Accordions and Tabs. (UI Components / Collapse)
README
# react-tabbordion
[![Version](https://img.shields.io/npm/v/react-tabbordion/latest)](https://www.npmjs.org/package/react-tabbordion)
[![NPM-Size](https://img.shields.io/bundlephobia/minzip/react-tabbordion@latest)](https://www.npmjs.com/package/react-tabbordion)
[![Build Status](https://img.shields.io/travis/merri/react-tabbordion/v1)](https://travis-ci.org/Merri/react-tabbordion)> Version 2.0 is now on beta, check it out!
>
> `npm install react-tabbordion@beta`
>
> For more information see [v2 branch @ GitHub](https://github.com/Merri/react-tabbordion/tree/v2)**Tabbordion** is a component for managing active state between multiple items. You can make anything out of it:
- Tabs component
- Accordion component
- Multi select list component
- Option component
- List of options
- List of checkboxesEssentially Tabbordion handles the state, gives tools for complete CSS based styling, manages WAI ARIA and provides a
great HTML/DOM structure to work with. Tabbordion is universal and therefore works both server side and client side!Keyboard usage works just like with radio buttons (or checkboxes when using `multiple` mode); the component avoids
reinventing the wheel and takes advantage of native browser behavior where possible, which is why you can't see any code
related to keyboard handling despite arrow keys and smart focus behavior being fully supported.You have complete control over the generated classNames, you can even disable generating them if you wish to. There is
only one required style:```css
[data-state="tabbordion"] {
clip: rect(0 0 0 0);
height: 1px;
position: absolute;
position: fixed;
width: 1px;
z-index: -1;
}
```This will hide the input elements so that they remain accessible via keyboard on all browsers.
## What is new with v1.0?
- You can now make Tabbordion stateless, thus place the state where you want!
- Full state control: Tabbordion makes sure the state is correct for given mode.
- Viewport resize support: when using `animateContent` elements are now updated when window is resized.
- `bemClassName` is now exposed.
- Performance optimizations for minimal renders. All Tabbordion components now extend PureComponent.## Demo, Documentation and Installation
View [Tabbordion demo](https://merri.github.io/react-tabbordion/) or [Documentation](./docs/).
```
npm install react-tabbordion
```[You're welcome to steal the demo styles](./demo/). Also, throw an issue if you have suggestions for improvements or
find problems with the demo styles :)### Usage example and sample output
```jsx
import { Tabbordion, TabPanel, TabLabel, TabContent } from 'react-tabbordion'const blockElements = {
content: 'tabs-content',
panel: 'tabs-panel',
label: 'tabs-title'
}
My title
Sample
Content
Another title
Another Sample
Some other kind of content
```
**Output:**
```html
-
My title
Sample
Content
-
Another title
Another Sample
Some other kind of content
```
The first tab is open as `single` mode is the default setting. If another mode is set then no tabs will be open unless
`initialPanels` is given.
## Developing
```
npm install
npm run build
npm test
```
There is no development environment provided that you could run in your localhost. I'm a bit old fashioned here, being
able to write things without all the cool tools. Sorry for being such a guy.