Web · APIs and utilities
Next.js (`@yasinsensoy/web/next`)
UIProvider ready for Next.js: in-site links render with next/link, so <Button href="/x"> navigates without a page reload.
Import
UIProvider ready for Next.js: in-site links render with next/link, so <Button href="/x"> navigates without a page reload. The current page is tracked with usePathname from next/navigation; Sidebar finds the active link itself.
Next.js does not allow passing functions (e.g. link={Link}) from a server-component layout to a client component, so next/link is wired here, on the client side. It can be used directly in the root layout; if icons will be passed, set it up in a client file ("use client"). See BaseUIProvider.
Examples
NextUIProviderProps
interfaceUIProvider props for Next.js; link becomes next/link automatically.
Extends: Omit<UIProviderProps, "link" | "usePathname" | "image">
| Name | Type | Default | Description |
|---|---|---|---|
optimizeImages? | boolean | false | Render Image and gallery images with next/image: Next serves each image at the box size as WebP/AVIF; a 4000 px photo drops to 300 px in a grid. Remote URLs require images.remotePatterns in next.config, which is why this is off by default. |