Skip to content

@hamur/fumadocs

The Fumadocs framework provider for Hamur React. It is a package, not a module: it adds nothing to modules. Fumadocs reads the path, the params, the router and the link component of your framework through its FrameworkProvider; this package fills them from @hamur/adapter-react. fumadocs-core and @hamur/adapter-react are its peers. The Docs with Fumadocs recipe builds a site with it.

sh
bun add @hamur/fumadocs fumadocs-core fumadocs-ui
tsx
// app/app.tsx
import { Outlet } from "@hamur/adapter-react"
import { HamurProvider } from "@hamur/fumadocs"
import { RootProvider } from "fumadocs-ui/provider/base"

export default function App() {
  return (
    <HamurProvider>
      <RootProvider>
        <Outlet />
      </RootProvider>
    </HamurProvider>
  )
}

HamurProvider

HamurProvider(props: HamurProviderProps) wraps its children in Fumadocs' FrameworkProvider with these parts:

Fumadocs hook or componentHamur
usePathname()useRoute().path
useParams()useRoute().params
useRouter()useRouter(): its push(url) and refresh()
LinkLink of @hamur/adapter-react, given href: a plain <a> the navigator handles
Imagenone: Fumadocs falls back to a plain <img>; pass Image for your own component

Place it above Fumadocs' RootProvider, inside the app root, so it can read the route. Without it, a Fumadocs component fails with You need to wrap your application inside \FrameworkProvider`.`

HamurProviderProps

PropTypeDefault
childrenReactNoderequired
LinkFramework["Link"]the Link of the adapter
ImageFramework["Image"]unset: a plain <img>

Framework is the type of fumadocs-core/framework; the package copies none of it. A Link or Image you pass replaces the default.