Skip to content

Commit 8c6fe9c

Browse files
committed
Docs: rename sidebar tabs to layout tabs
1 parent 4fd51b7 commit 8c6fe9c

File tree

9 files changed

+32
-78
lines changed

9 files changed

+32
-78
lines changed

apps/docs/content/docs/(framework)/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const source = loader({
145145
</Accordion>
146146

147147
<Accordion id='multi-docs' title="How to implement multi-docs?">
148-
We recommend to use [Sidebar Tabs](/docs/ui/layouts/docs#sidebar-tabs).
148+
We recommend using [Layout Tabs](/docs/ui/layouts/docs#layout-tabs).
149149
</Accordion>
150150

151151
</Accordions>

apps/docs/content/docs/(framework)/navigation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ For example:
5353
</Files>
5454

5555
<Callout title="Good to Know">
56-
When grouping with folders, you can display them as tabs [using Sidebar
57-
Tabs](/docs/ui/layouts/docs#sidebar-tabs).
56+
When grouping with folders, you can display them as tabs [using Layout
57+
Tabs](/docs/ui/layouts/docs#layout-tabs).
5858
</Callout>
5959

6060
### Full Versioning

apps/docs/content/docs/headless/page-conventions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ For example, when you are opening root folder `framework`, the other folders (e.
100100

101101
<Callout title='Fumadocs UI'>
102102

103-
Fumadocs UI renders root folders as [Sidebar Tabs](/docs/ui/layouts/docs#sidebar-tabs), which allows user to switch between them.
103+
Fumadocs UI renders root folders as [Layout Tabs](/docs/ui/layouts/docs#layout-tabs), which allows users to switch between them.
104104

105105
</Callout>
106106

apps/docs/content/docs/ui/layouts/docs.mdx

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import { DocsLayout } from 'fumadocs-ui/layouts/docs';
5252

5353
Customise sidebar navigation links.
5454

55-
<div className='flex justify-center items-center *:max-w-[200px] bg-gradient-to-br from-fd-primary/10 rounded-xl border'>
55+
<div className='flex justify-center items-center *:max-w-[200px] bg-linear-to-br from-fd-primary/10 rounded-xl border'>
5656

5757
![Sidebar](/docs/sidebar.png)
5858

@@ -100,13 +100,13 @@ export default function Layout({ children }: { children: ReactNode }) {
100100
}
101101
```
102102

103-
### Sidebar Tabs (Dropdown) [#sidebar-tabs]
103+
### Layout Tabs (Dropdown) [#layout-tabs]
104104

105-
Sidebar Tabs are folders with tab-like behaviours, only the content of opened tab will be visible.
105+
Layout Tabs are folders with tab-like behaviours, only the content of opened tab will be visible.
106106

107107
<div className='flex justify-center items-center *:max-w-[360px] bg-linear-to-br from-fd-primary/10 rounded-xl border'>
108108

109-
![Sidebar Tabs](/docs/sidebar-tabs.png)
109+
![Layout Tabs](/docs/sidebar-tabs.png)
110110

111111
</div>
112112

@@ -128,19 +128,17 @@ Or specify them explicitly:
128128
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
129129

130130
<DocsLayout
131-
sidebar={{
132-
tabs: [
133-
{
134-
title: 'Components',
135-
description: 'Hello World!',
136-
// active for `/docs/components` and sub routes like `/docs/components/button`
137-
url: '/docs/components',
138-
139-
// optionally, you can specify a set of urls which activates the item
140-
// urls: new Set(['/docs/test', '/docs/components']),
141-
},
142-
],
143-
}}
131+
tabs={[
132+
{
133+
title: 'Components',
134+
description: 'Hello World!',
135+
// active for `/docs/components` and sub routes like `/docs/components/button`
136+
url: '/docs/components',
137+
138+
// optionally, you can specify a set of urls which activates the item
139+
// urls: new Set(['/docs/test', '/docs/components']),
140+
},
141+
]}
144142
/>;
145143
```
146144

@@ -149,7 +147,7 @@ Set it to `false` to disable:
149147
```tsx
150148
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
151149

152-
<DocsLayout sidebar={{ tabs: false }} />;
150+
<DocsLayout tabs={false} />;
153151
```
154152

155153
<Callout title="Want further customisations?">
@@ -182,19 +180,17 @@ export default function Layout({ children }: { children: ReactNode }) {
182180

183181
#### Decoration
184182

185-
Change the icon/styles of tabs.
183+
Change the icon/styles of layout tabs.
186184

187185
```tsx
188186
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
189187

190188
<DocsLayout
191-
sidebar={{
192-
tabs: {
193-
transform: (option, node) => ({
194-
...option,
195-
icon: <MyIcon />,
196-
}),
197-
},
189+
tabs={{
190+
transform: (option, node) => ({
191+
...option,
192+
icon: <MyIcon />,
193+
}),
198194
}}
199195
/>;
200196
```

apps/docs/content/docs/ui/layouts/notebook.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The options are inherited from [Docs Layout](/docs/ui/layouts/docs), with minor
4444

4545
### Tab Mode
4646

47-
Configure the style of [Layout Tabs](/docs/ui/layouts/docs#sidebar-tabs).
47+
Configure the style of [Layout Tabs](/docs/ui/layouts/docs#layout-tabs).
4848

4949
![Notebook](/docs/notebook-tab-mode.png)
5050

packages/base-ui/registry/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ export const registry: Registry = {
3939
path: 'components/sidebar/link-item.tsx',
4040
target: '<dir>/layout/sidebar/link-item.tsx',
4141
},
42-
{
43-
type: 'components',
44-
path: 'components/sidebar/tabs/index.tsx',
45-
target: '<dir>/layout/sidebar/tabs/index.tsx',
46-
},
47-
{
48-
type: 'components',
49-
path: 'components/sidebar/tabs/dropdown.tsx',
50-
target: '<dir>/layout/sidebar/tabs/dropdown.tsx',
51-
},
5242
],
5343
},
5444
{

packages/base-ui/src/components/sidebar/tabs/dropdown.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import { type ComponentProps, type ReactNode, useMemo, useState } from 'react';
44
import Link from 'fumadocs-core/link';
55
import { usePathname } from 'fumadocs-core/framework';
66
import { cn } from '@/utils/cn';
7-
import { normalize, isActive } from '@/utils/urls';
87
import { useSidebar } from '@/components/sidebar/base';
98
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
10-
import type { SidebarTab } from '.';
9+
import { isLayoutTabActive, type LayoutTab } from '@/layouts/shared';
1110

12-
export interface SidebarTabWithProps extends SidebarTab {
13-
props?: ComponentProps<'a'>;
14-
}
11+
export type SidebarTabWithProps = LayoutTab;
1512

1613
export function SidebarTabsDropdown({
1714
options,
@@ -100,8 +97,4 @@ export function SidebarTabsDropdown({
10097
);
10198
}
10299

103-
export function isTabActive(tab: SidebarTab, pathname: string) {
104-
if (tab.urls) return tab.urls.has(normalize(pathname));
105-
106-
return isActive(tab.url, pathname, true);
107-
}
100+
export const isTabActive = isLayoutTabActive;

packages/base-ui/src/components/sidebar/tabs/index.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
1+
import type { LayoutTab } from '@/layouts/shared';
12
import type * as PageTree from 'fumadocs-core/page-tree';
2-
import type { ReactNode } from 'react';
33

4-
export interface SidebarTab {
5-
/**
6-
* Redirect URL of the folder, usually the index page
7-
*/
8-
url: string;
9-
10-
icon?: ReactNode;
11-
title: ReactNode;
12-
description?: ReactNode;
13-
14-
/**
15-
* Detect from a list of urls
16-
*/
17-
urls?: Set<string>;
18-
unlisted?: boolean;
19-
}
4+
export type SidebarTab = LayoutTab;
205

216
export interface GetSidebarTabsOptions {
227
transform?: (option: SidebarTab, node: PageTree.Folder) => SidebarTab | null;

packages/radix-ui/registry/index.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ export const registry: Registry = {
3939
path: 'components/sidebar/link-item.tsx',
4040
target: '<dir>/layout/sidebar/link-item.tsx',
4141
},
42-
{
43-
type: 'components',
44-
path: 'components/sidebar/tabs/index.tsx',
45-
target: '<dir>/layout/sidebar/tabs/index.tsx',
46-
},
47-
{
48-
type: 'components',
49-
path: 'components/sidebar/tabs/dropdown.tsx',
50-
target: '<dir>/layout/sidebar/tabs/dropdown.tsx',
51-
},
5242
],
5343
},
5444
{

0 commit comments

Comments
 (0)