fumadocs-core
Version:
The React.js library for building a documentation website
47 lines • 1.31 kB
TypeScript
import { O as LoaderPlugin } from "../../index-Dyo_baWl.js";
import { a as Separator$1, n as Item$1, t as Folder$1 } from "../../definitions-BQVehOBz.js";
import { ReactNode } from "react";
export interface Item extends Item$1 {
/**
* Status badge to display in the sidebar (e.g., "new", "beta", "deprecated", "experimental").
*/
status?: string;
}
export interface Folder extends Omit<Folder$1, 'children' | 'index'> {
index?: Item;
children: Node[];
}
export type Separator = Separator$1;
export type Node = Item | Folder | Separator;
/**
* Plugin to add status badges to pages in the sidebar.
*
* This reads the `status` field from page frontmatter and adds it to the page tree item.
* Define the `renderBadge` option to render it.
*
* @example
* ```tsx
* import { loader } from 'fumadocs-core/source';
* import { statusBadgesPlugin } from 'fumadocs-core/source/status-badges';
*
* export const source = loader({
* plugins: [
* statusBadgesPlugin({
* renderBadge: (status) => <span>{status}</span>,
* }),
* ],
* // ...
* });
* ```
*
* Then in your frontmatter:
* ```yaml
* ---
* title: My Page
* status: new
* ---
* ```
*/
export declare function statusBadgesPlugin(options?: {
renderBadge?: (status: string) => ReactNode;
}): LoaderPlugin;