Package detail

@chakra-xui/tabs

chakra-xui18MIT1.0.2

Accessible Tabs component for React and Chakra xui

react, react component, tabs, accessible tabs

readme

@chakra-xui/tabs

An accessible tabs component.

The Tab and TabPanel elements are associated by their order in the tree. None of the components are empty wrappers, each is associated with a real DOM element in the document, giving you maximum control over styling and composition.

Installation

yarn add @chakra-xui/tabs

# or

npm i @chakra-xui/tabs

Import components

import { Tabs, TabList, TabPanels, Tab, TabPanel } from "@chakra-xui/react"

Usage

<Tabs>
  <TabList>
    <Tab>One</Tab>
    <Tab>Two</Tab>
    <Tab>Three</Tab>
  </TabList>

  <TabPanels>
    <TabPanel>
      <p>one!</p>
    </TabPanel>
    <TabPanel>
      <p>two!</p>
    </TabPanel>
    <TabPanel>
      <p>three!</p>
    </TabPanel>
  </TabPanels>
</Tabs>

Tab variants and color schemes

Tabs come in 6 different variants to style the tabs: line,enclosed, enclosed-colored, soft-rounded, solid-rounded. Each variant comes it different color schemes.

<Tabs variant="enclosed" colorScheme="red">
  <TabList>
    <Tab>One</Tab>
    <Tab>Two</Tab>
  </TabList>
  <TabPanels>
    <TabPanel>
      <p>one!</p>
    </TabPanel>
    <TabPanel>
      <p>two!</p>
    </TabPanel>
  </TabPanels>
</Tabs>

Manually Activated Tabs

By default, Tabs are activated automatically. This means when you use the arrow keys to change tabs, the tab is activated and focused.

The content of a TabPanel should ideally be preloaded. However, if switching to a tab panel causes a network request and possibly a page refresh, there might be some notable latency and this might affect the experience for keyboard and screen reader users.

In this scenario, you should use a manually activated tab, it moves focus without activating the tabs. With focus on a specifc tab, users can activate a tab by pressing <kbd>Space</kbd> or <kbd>Enter</kbd>.

<Tabs isManual variant="enclosed">
  <TabList>
    <Tab>One</Tab>
    <Tab>Two</Tab>
  </TabList>
  <TabPanels>
    <TabPanel>
      <p>one!</p>
    </TabPanel>
    <TabPanel>
      <p>two!</p>
    </TabPanel>
  </TabPanels>
</Tabs>

Tab sizes

You can change the size of the tab by passing size prop. We support 3 sizes sm, md, lg

<Tabs size="md" variant="enclosed">
  <TabList>
    <Tab>One</Tab>
    <Tab>Two</Tab>
  </TabList>
  <TabPanels>
    <TabPanel>
      <p>one!</p>
    </TabPanel>
    <TabPanel>
      <p>two!</p>
    </TabPanel>
  </TabPanels>
</Tabs>

changelog

Change Log

1.0.2

Patch Changes

  • Updated dependencies [e73878ee]:
    • @chakra-xui/utils@1.0.2
    • @chakra-xui/clickable@1.0.2
    • @chakra-xui/hooks@1.0.2
    • @chakra-xui/descendant@1.0.2

1.0.1

Patch Changes

  • 892ea2ca Thanks @segunadebayo! - - Fix orientation styles for Tabs when orientation prop is vertical #1187

    • Add support for styling the root tab element from theme #2548
  • Updated dependencies [5c482483, 204ff7e3]:

    • @chakra-xui/utils@1.0.1
    • @chakra-xui/hooks@1.0.1
    • @chakra-xui/clickable@1.0.1
    • @chakra-xui/descendant@1.0.1

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0 (2020-11-13)

Note: Version bump only for package @chakra-xui/tabs

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-rc.8 (2020-10-29)

Bug Fixes

  • toast: allow custom render in update (eb8bff9), closes #2362

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-rc.7 (2020-10-25)

Note: Version bump only for package @chakra-xui/tabs

1.0.0-rc.6 (2020-10-25)

Note: Version bump only for package @chakra-xui/tabs

1.0.0-rc.5 (2020-09-27)

Note: Version bump only for package @chakra-xui/tabs

1.0.0-rc.4 (2020-09-25)

Note: Version bump only for package @chakra-xui/tabs

1.0.0-rc.3 (2020-08-30)

Note: Version bump only for package @chakra-xui/tabs

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-rc.2 (2020-08-09)

Note: Version bump only for package @chakra-xui/tabs

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-rc.1 (2020-08-06)

Bug Fixes

  • variables: drop unused imports (552b2e9)

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-rc.0 (2020-07-26)

Note: Version bump only for package @chakra-xui/tabs

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-next.7 (2020-07-26)

Bug Fixes

  • types issue in use-tabs (c388927)

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-next.6 (2020-07-15)

Note: Version bump only for package @chakra-xui/tabs

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-next.5 (2020-07-15)

Bug Fixes

  • tabs align prop didnt do anything (8e56b1b)

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-next.4 (2020-07-01)

Bug Fixes

Features

  • support global tab indicator styling (548f975)

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-next.3 (2020-06-28)

Bug Fixes

Features

  • support global tab indicator styling (548f975)

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.0-next.2 (2020-06-21)

Bug Fixes

Features

  • support global tab indicator styling (548f975)