0.1.2 • Published 6 years ago

a11y-react-tabs v0.1.2

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

Simple React Tabs

Primitives to build simple and accessible React tabs component.

Installation

npm install a11y-react-tabs

Basic Usage

import { Tabs, TabList, Tab, TabPanel } from 'a11y-react-tabs'

export default () => {
  <Tabs>
    <TabList>
      <Tab>Tab 1</Tab>
      <Tab>Tab 2</Tab>
      <Tab>Tab 3</Tab>
    </TabList>
    <TabPanel>
      Tab Panel 1
    </TabPanel>
    <TabPanel>
      Tab Panel 2
    </TabPanel>
    <TabPanel>
      <Tabs>
        <TabList>
          <Tab>It Supports</Tab>
          <Tab>Nested Tabs!</Tab>
        </TabList>
        <TabPanel>
          Tab Panel 1
        </TabPanel>
        <TabPanel>
          Tab Panel 2
        </TabPanel>
      </Tabs>
    </TabPanel>
  </Tabs>
}

Components

Tabs

props

PropTypeDefaultDescription
className optionalstringa11y-react-tabsClass name for the <Tab /> component.

TabList

props

PropTypeDefaultDescription
className optionalstringa11y-react-tabs__tablistClass name for the <TabPanel /> component.

Tab

props

PropTypeDefaultDescription
disabled optionalbooleanfalseDisable the tab if set to true.
className optionalstringa11y-react-tabs__tabClass name for the <Tab /> component.
selectedClassName optionalstringa11y-react-tabs__tab--selectedClass name for the active tab.
disabledClassName optionalstringa11y-react-tabs__tab--disabledClass name for the disabled tab.

TabPanel

props

PropTypeDefaultDescription
className optionalstringa11y-react-tabs__tab-panelClass name for the<TabPanel /> component.
selectedClassName optionalstringa11y-react-tabs__tab-panel--selectedClass name for the active tab panel.

Demo

TODO:

  • documentation
  • usage example
  • tests

License

MIT

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago