Tabs
A component for toggling between related panels on the same page.
Measured from the Mintlify docs' Tabs page, underline tabs, light and dark.
import { Tabs } from "@replicas/ui";
export default function TabsDemo() {
return (
<Tabs.Root defaultValue="all" style={{ display: "flex", flexDirection: "column", gap: 12, width: 280 }}>
<Tabs.List>
<Tabs.Tab value="all">All files</Tabs.Tab>
<Tabs.Tab value="recent">Recent</Tabs.Tab>
<Tabs.Tab value="shared">Shared</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="all">128 files across 4 folders.</Tabs.Panel>
<Tabs.Panel value="recent">23 files opened this week.</Tabs.Panel>
<Tabs.Panel value="shared">14 files shared with you.</Tabs.Panel>
</Tabs.Root>
);
}Examples
Variants
<Tabs.Root defaultValue="overview">
<Tabs.List variant="underline">
<Tabs.Tab value="overview">Overview</Tabs.Tab>
<Tabs.Tab value="activity">Activity</Tabs.Tab>
</Tabs.List>
</Tabs.Root>
<Tabs.Root defaultValue="overview">
<Tabs.List variant="pill">
<Tabs.Tab value="overview">Overview</Tabs.Tab>
<Tabs.Tab value="activity">Activity</Tabs.Tab>
</Tabs.List>
</Tabs.Root>Prompt
Copy Prompt hands your agent everything it needs to build the Tabs in the Mintlify style: the measured tokens, the CSS and the structure.
Show Prompt
# Mintlify Tabs
A component for toggling between related panels on the same page.
Build a Tabs in this project that looks and behaves like Mintlify's. Measured from the running Mintlify app (mintlify.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/tabs) if it has none.
Fidelity: Measured from the Mintlify docs' Tabs page, underline tabs, light and dark.
## Variants
- `variant`: `underline`, `pill`
## Tokens
| Token | Light | Dark |
| --- | --- | --- |
| `--mint-gray-200` | `rgb(223 225 224)` | `rgb(223 225 224)` |
| `--mint-gray-300` | `rgb(206 209 207)` | `rgb(206 209 207)` |
| `--mint-gray-400` | `rgb(159 161 160)` | `rgb(159 161 160)` |
| `--mint-gray-600` | `rgb(80 83 81)` | `rgb(80 83 81)` |
| `--mint-gray-700` | `rgb(63 65 64)` | `rgb(63 65 64)` |
| `--mint-gray-900` | `rgb(23 26 24)` | `rgb(23 26 24)` |
| `--mint-gray-950` | `rgb(10 13 12)` | `rgb(10 13 12)` |
| `--mint-primary` | `rgb(22 110 63)` | `rgb(22 110 63)` |
| `--mint-primary-light` | `rgb(38 189 108)` | `rgb(38 189 108)` |
| `--text-primary` | `rgb(10 13 12)` | `#ffffff` |
| `--bg-hover` | `rgb(10 13 12 / 0.03)` | `rgb(255 255 255 / 0.06)` |
| `--tabs-border` | `rgb(223 225 224)` | `rgb(223 225 224 / 0.1)` |
| `--focus-ring` | `rgb(22 110 63)` | `rgb(38 189 108)` |
| `--font-size-small` | `0.875rem` | `0.875rem` |
| `--font-weight-medium` | `500` | `500` |
| `--font-weight-semibold` | `600` | `600` |
| `--radius-rounded` | `9999px` | `9999px` |
## CSS
Scoped under `[data-style="mintlify"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.
```css
[data-style="mintlify"] {
.ui-tabs-list {
position: relative;
box-sizing: border-box;
display: flex;
align-items: flex-end;
column-gap: 24px;
padding-bottom: 1px;
border-bottom: 1px solid var(--tabs-border);
&[data-orientation="vertical"] {
flex-direction: column;
align-items: stretch;
row-gap: 4px;
padding-bottom: 0;
border-bottom: 0;
border-left: 1px solid var(--tabs-border);
}
}
.ui-tabs-tab {
position: relative;
box-sizing: border-box;
display: inline-flex;
align-items: center;
gap: 6px;
margin: 0 0 -1px;
padding: 12px 0 10px;
border: 0;
border-bottom: 1px solid transparent;
border-radius: 0;
background-color: transparent;
color: var(--mint-gray-900);
font-family: inherit;
font-size: var(--font-size-small);
font-weight: var(--font-weight-semibold);
line-height: 24px;
font-feature-settings: "ss01" 0, "ss02" 0, "ss03" 0;
white-space: nowrap;
user-select: none;
cursor: pointer;
&:focus-visible {
border-radius: 4px;
outline: 2px solid var(--focus-ring);
outline-offset: -2px;
}
@media (hover: hover) {
&:hover:not([data-disabled], [data-active]) {
border-bottom-color: var(--mint-gray-300);
}
}
&[data-active] {
border-bottom-color: currentColor;
color: var(--mint-primary);
}
&[data-disabled] {
opacity: 0.5;
cursor: default;
}
& svg {
width: 16px;
height: 16px;
flex-shrink: 0;
}
}
.ui-tabs-list[data-orientation="vertical"] .ui-tabs-tab {
margin: 0 0 0 -1px;
padding: 6px 0 6px 12px;
border-bottom: 0;
border-left: 1px solid transparent;
&[data-active] {
border-left-color: currentColor;
}
@media (hover: hover) {
&:hover:not([data-disabled], [data-active]) {
border-left-color: var(--mint-gray-300);
}
}
}
.ui-tabs-list[data-variant="pill"] {
column-gap: 2px;
padding-bottom: 0;
border-bottom: 0;
& .ui-tabs-tab {
height: 36px;
margin: 0;
padding: 0 16px;
border: 0;
border-radius: var(--radius-rounded);
color: var(--mint-gray-600);
font-weight: var(--font-weight-medium);
line-height: 20px;
letter-spacing: -0.35px;
@media (hover: hover) {
&:hover:not([data-disabled], [data-active]) {
background-color: var(--bg-hover);
color: var(--mint-gray-900);
}
}
&[data-active] {
background-color: var(--bg-hover);
color: var(--mint-gray-950);
}
}
}
.ui-tabs-panel {
padding-top: 24px;
color: var(--mint-gray-700);
font-size: var(--font-size-small);
line-height: 24px;
outline: none;
&:focus-visible {
border-radius: 4px;
outline: 2px solid var(--focus-ring);
outline-offset: 2px;
}
}
&[data-theme="dark"] {
& .ui-tabs-tab {
color: var(--mint-gray-200);
@media (hover: hover) {
&:hover:not([data-disabled], [data-active]) {
border-color: var(--mint-gray-700);
}
}
&[data-active] {
color: var(--mint-primary-light);
}
}
& .ui-tabs-list[data-variant="pill"] .ui-tabs-tab {
color: var(--mint-gray-400);
@media (hover: hover) {
&:hover:not([data-disabled], [data-active]) {
color: var(--mint-gray-200);
}
}
&[data-active] {
color: var(--text-primary);
}
}
& .ui-tabs-panel {
color: var(--mint-gray-400);
}
}
}
```
## Structure
How Replicas assembles it on Base UI.
```tsx
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
const join = (base: string, extra?: string) => (extra ? `${base} ${extra}` : base);
function List({
className,
variant,
size,
...props
}: Omit<BaseTabs.List.Props, "className"> & { className?: string; variant?: string; size?: string }) {
return <BaseTabs.List className={join("ui-tabs-list", className)} data-variant={variant} data-size={size} {...props} />;
}
function Tab({ className, ...props }: Omit<BaseTabs.Tab.Props, "className"> & { className?: string }) {
return <BaseTabs.Tab className={join("ui-tabs-tab", className)} {...props} />;
}
function Panel({ className, ...props }: Omit<BaseTabs.Panel.Props, "className"> & { className?: string }) {
return <BaseTabs.Panel className={join("ui-tabs-panel", className)} {...props} />;
}
export const Tabs = {
Root: BaseTabs.Root,
List,
Tab,
Panel,
};
```
## Example
```tsx
import { Tabs } from "@replicas/ui";
export default function TabsDemo() {
return (
<Tabs.Root defaultValue="all" style={{ display: "flex", flexDirection: "column", gap: 12, width: 280 }}>
<Tabs.List>
<Tabs.Tab value="all">All files</Tabs.Tab>
<Tabs.Tab value="recent">Recent</Tabs.Tab>
<Tabs.Tab value="shared">Shared</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="all">128 files across 4 folders.</Tabs.Panel>
<Tabs.Panel value="recent">23 files opened this week.</Tabs.Panel>
<Tabs.Panel value="shared">14 files shared with you.</Tabs.Panel>
</Tabs.Root>
);
}
```
## Foundations
The rest of the Mintlify style, as a skill: https://replicas.raphaelsalaja.com/skills/mintlify/SKILL.md