UNPKG

next13-progressbar

Version:

A ProgressBar for next.js >=13 with app directory

67 lines (63 loc) 2.06 kB
import * as React from 'react'; import * as NProgress from 'nprogress'; import * as next_dist_shared_lib_app_router_context_shared_runtime from 'next/dist/shared/lib/app-router-context.shared-runtime'; import { NavigateOptions } from 'next/dist/shared/lib/app-router-context.shared-runtime'; declare function useRouter(): { push: (href: string, options?: NavigateOptions) => void | Promise<boolean>; replace: (href: string, options?: NavigateOptions) => void | Promise<boolean>; back(): void; forward(): void; refresh(): void; prefetch(href: string, options?: next_dist_shared_lib_app_router_context_shared_runtime.PrefetchOptions | undefined): void; }; interface Next13ProgressProps { /** * The color of the bar. * @default "#29D" */ color?: string; /** * The start position of the bar. * @default 0.3 */ startPosition?: number; /** * The delay in milliseconds. * @default 0 */ delay?: number; /** * The stop delay in milliseconds. * @default 200 */ stopDelayMs?: number; /** * The height of the bar. * @default 3 */ height?: number | string; /** * Whether to show the bar on shallow routes. * @default true */ showOnShallow?: boolean; /** * The other NProgress configuration options to pass to NProgress. * @default null */ options?: Partial<NProgress.NProgressOptions>; /** * The nonce attribute to use for the `style` tag. * @default undefined */ nonce?: string; /** * Use your custom CSS tag instead of the default one. * This is useful if you want to use a different style or minify the CSS. * @default (css) => <style nonce={nonce}>{css}</style> */ transformCSS?: (css: string) => JSX.Element; style?: string; } declare const Next13ProgressBar: (props: Next13ProgressProps & JSX.IntrinsicAttributes) => React.JSX.Element; export { Next13ProgressBar, Next13ProgressProps, Next13ProgressBar as default, useRouter };