fumadocs-core
Version:
The library for building a documentation website in any React.js framework
47 lines (44 loc) • 1.43 kB
TypeScript
import { ReactNode } from 'react';
import { R as Root, N as Node } from './definitions-Q95-psoo.js';
interface BreadcrumbItem {
name: ReactNode;
url?: string;
}
interface BreadcrumbOptions {
/**
* Include the root folders in the breadcrumb items array.
*
* @defaultValue false
*/
includeRoot?: boolean | {
/**
* Specify the url of root
*/
url: string;
};
/**
* Include the page itself in the breadcrumb items array
*
* @defaultValue false
*/
includePage?: boolean;
/**
* Count separator as an item
*
* @defaultValue false
*/
includeSeparator?: boolean;
}
declare function useBreadcrumb(url: string, tree: Root, options?: BreadcrumbOptions): BreadcrumbItem[];
declare function getBreadcrumbItems(url: string, tree: Root, options?: BreadcrumbOptions): BreadcrumbItem[];
declare function getBreadcrumbItemsFromPath(tree: Root, path: Node[], options: BreadcrumbOptions): BreadcrumbItem[];
/**
* Search the path of a node in the tree by a specified url
*
* - When the page doesn't exist, return null
*
* @returns The path to the target node from root
* @internal Don't use this on your own
*/
declare function searchPath(nodes: Node[], url: string): Node[] | null;
export { type BreadcrumbItem, type BreadcrumbOptions, getBreadcrumbItems, getBreadcrumbItemsFromPath, searchPath, useBreadcrumb };