Tabs
Tabbed content sections for organizing related content
Tabs
A component for creating tabbed content sections. Useful for showing multiple code examples, alternative approaches, or organizing related content.
Usage
Create tabs using the ::tabs and ::tabs-item components:
::tabs
::tabs-item{label="First Tab"}
Content for the first tab.
::
::tabs-item{label="Second Tab"}
Content for the second tab.
::
::
Content for the first tab.
Code Examples
Tabs are useful for showing code in different languages or frameworks:
::tabs
::tabs-item{label="Vue"}
\`\`\`vue
<script setup>
const count = ref(0)
</script>
<template>
<button @click="count++">{{ count }}</button>
</template>
\`\`\`
::
::tabs-item{label="React"}
\`\`\`tsx
function Counter() {
const [count, setCount] = useState(0)
return <button onClick={() => setCount(c => c + 1)}>{count}</button>
}
\`\`\`
::
::
<script setup>
const count = ref(0)
</script>
<template>
<button @click="count++">
{{ count }}
</button>
</template>
Package Manager Example
Use the sync prop to remember the user's choice across tabs:
::tabs{sync="pm"}
::tabs-item{label="npm"}
\`\`\`bash
npm install @pleaseai/docs
\`\`\`
::
::tabs-item{label="pnpm"}
\`\`\`bash
pnpm add @pleaseai/docs
\`\`\`
::
::tabs-item{label="bun"}
\`\`\`bash
bun add @pleaseai/docs
\`\`\`
::
::
With Icons
Add icons to tab triggers using the icon prop:
::tabs
::tabs-item{label="Vue" icon="i-logos-vue"}
Vue content here.
::
::tabs-item{label="React" icon="i-logos-react"}
React content here.
::
::
Components
Tabs
The root container for the tab system.
TabsItem
Individual tab content panel with its trigger label.
Styling
The tabs component uses an underline style for the active tab indicator. Active tabs show a primary-colored bottom border with smooth transitions on hover and selection.