Tabs
Learn how to display content within different tabs
Use the <Tabs /> component to display content within different tabs.
Example
To display tabs, provide the <Tabs> component with child <TabItem /> components:
<Tabs>
<TabItem label="First Tab" value="first">👋 This is the content for the first tab.</TabItem>
<TabItem label="Second Tab" value="second">...and this is the content for the second tab!</TabItem>
</Tabs>
Tabs Props
defaultValuestringoptionalThe default tab to display. Needs to match a TabItem's value prop.
Defaults to the first tab.
TabItem Props
labelstringrequiredThe label to display for the tab.
valuestringrequiredThe value of the tab. Use this to identify the tab for the defaultValue property.
Synchronizing Tabs
To synchronize the tabs across documentation, provide a unique groupId prop. Any tabs
displayed across the documentation with this groupId will be synchronized. This state
also persists across page reloads.
This is useful if you display content within tabs in multiple places with the same headings (e.g. examples of code snippets in different languages). If the user chooses a language, they don't have to keep selecting it everywhere.
<Tabs
groupId="language"
>
Example
The below examples shows how to perform a network request to our API.
First, import the package:
Import the axios package:
npm i --save axios
Now import it in your code:
import axios from 'axios';
Next, perform a network request to 'https://example.com':
const response = await axios.get('https://example.com');
console.log(response.data);
