Command palette

@yasinsensoy/web

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.

2 exports

Import

import { UIProvider } from "@yasinsensoy/web/next";

UIProvider

componentClient component

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.

UIProvider({ optimizeImages, ...props }: NextUIProviderProps): JSX.Element

Examples

// app/layout.tsx
import { UIProvider } from "@yasinsensoy/web/next";

<UIProvider>
  {children}
  <Toaster />
</UIProvider>

UIProvider props for Next.js; link becomes next/link automatically.

Extends: Omit<UIProviderProps, "link" | "usePathname" | "image">

NameTypeDefaultDescription
optimizeImages?booleanfalseRender 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.