Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@contentful/f36-tabs

Package Overview
Dependencies
Maintainers
100
Versions
343
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/f36-tabs

Forma 36: Tabs component

  • 4.0.1-next-v4-6317.2231
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24K
decreased by-15.03%
Maintainers
100
Weekly downloads
 
Created
Source

title: 'Tabs' type: 'component' status: 'stable' slug: /components/tabs/ github: 'https://github.com/contentful/forma-36/tree/master/packages/components/tabs' storybook: 'https://f36-storybook.contentful.com/?path=/story/components-tabs--basic' typescript: ./src/Tabs.tsx,./src/Tab.tsx,./src/TabPanel.tsx

Tabs is a component that makes navigating between sections of related content possible, displaying one section at a time.

Table of contents

How to use Tabs

Use Tabs if the content can be separated into sections that make sense as standalone pieces of information. Be aware that the users will not see all the content at the same time. Make sure the first section is the most relevant one.

Code examples

// import {Tabs, Tab} from '@contentful/f36-tabs';

<Tabs role="tablist">
  <Tab id="first" href="https://contentful.com" isSelected>
    First
  </Tab>
  <Tab id="second" href="https://contentful.com">
    Second
  </Tab>
  <Tab id="third" href="https://contentful.com">
    Third
  </Tab>
</Tabs>

with vertical divider

// import {Tabs, Tab} from '@contentful/f36-tabs';

<Tabs role="tablist" variant="vertical-divider">
  <Tab id="first" href="https://contentful.com" isSelected>
    First
  </Tab>
  <Tab id="second" href="https://contentful.com">
    Second
  </Tab>
  <Tab id="third" href="https://contentful.com">
    Third
  </Tab>
</Tabs>

as navigation

// import {Tabs, Tab} from '@contentful/f36-tabs';

<Tabs role="navigation">
  <Tab id="first" href="https://contentful.com" isSelected>
    First
  </Tab>
  <Tab id="second" href="https://contentful.com">
    Second
  </Tab>
  <Tab id="third" href="https://contentful.com">
    Third
  </Tab>
</Tabs>

used with TabPanel

// import {Tabs, Tab, TabPanel} from '@contentful/f36-tabs';

() => {
  const [selected, setSelected] = React.useState('first');

  return (
    <>
      <Tabs role="tablist">
        <Tab id="first" isSelected={selected === 'first'}>
          First
        </Tab>
        <Tab id="second" isSelected={selected === 'second'}>
          Second
        </Tab>
      </Tabs>
      {selected === 'first' && (
        <TabPanel id="first">Content for the first tab</TabPanel>
      )}
      {selected === 'second' && (
        <TabPanel id="second">Content for the second tab</TabPanel>
      )}
    </>
  );
};

Content recommendations

  • every Tab should have concise copy
  • all content within a Tab should be related to it's label
  • to ensure an optimal cognitive load for users, do not use more than six (6) Tabs at any given time

Props

import { Props } from '@contentful/f36-docs-utils';

Tabs

Tab

TabPanel

FAQs

Package last updated on 17 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc