[**Documentation**](../../README)

***

[Documentation](../../README) / @zerotal/inertia

# @zerotal/inertia

The Inertia.js adapter for Zerotal — build React or Vue single-page apps with
no separate API layer.

Controllers return [\`inertia('PageName', props)\`](functions/inertia) instead of
JSON or HTML: on a full page load the adapter renders the HTML shell, and on
subsequent visits it returns a JSON page object that the Inertia client swaps
into the current page component. [Shared props](functions/share) expose global
data (the authenticated user, flash messages) to every page, the
[optional](functions/optional)/[lazy](functions/lazy)/[defer](functions/defer) prop helpers control what is sent
on partial reloads, and [SSR](classes/SsrHandler) renders the first paint on
the server.

## Examples

**Return an Inertia page from a controller**

```ts
import { inertia } from "@zerotal/inertia";

export async function index(ctx) {
  const users = await User.query().get();
  return inertia("Users/Index", { users });
}
```

**Share global props at boot**

```ts
import { share } from "@zerotal/inertia";

share("appName", () => config("app.name"));
```

## Remarks

Register `InertiaProvider`. React consumers need `react`/`react-dom`; Vue
consumers need `vue`/`@inertiajs/vue3` (declare whichever you use). Requires
**Bun ≥ 1.1**.

## Other

- [SsrHandler](classes/SsrHandler)
- [InertiaConfigShape](interfaces/InertiaConfigShape)
- [InertiaConfig](functions/InertiaConfig)
- [InertiaError](classes/InertiaError)
- [InertiaTemplateNotLoadedError](classes/InertiaTemplateNotLoadedError)
- [InvalidComponentError](classes/InvalidComponentError)
- [Inertia](variables/Inertia)
- [encryptHistory](functions/encryptHistory)
- [clearHistory](functions/clearHistory)
- [inertiaStream](functions/inertiaStream)
- [inertia](functions/inertia)
- [location](functions/location)
- [InertiaMiddleware](classes/InertiaMiddleware)
- [PrecognitionMiddleware](classes/PrecognitionMiddleware)
- [PropFactory](type-aliases/PropFactory)
- [MergeConfig](interfaces/MergeConfig)
- [PaginatorLike](interfaces/PaginatorLike)
- [ScrollConfig](interfaces/ScrollConfig)
- [ResolvedPage](interfaces/ResolvedPage)
- [InertiaProvider](classes/InertiaProvider)
- [inertiaRoute](functions/inertiaRoute)
- [share](functions/share)
- [PageObject](interfaces/PageObject)
- [InertiaProviderOptions](interfaces/InertiaProviderOptions)
- [assetVersion](functions/assetVersion)
- [detectVuePlugin](functions/detectVuePlugin)

## Props

- [InertiaProp](classes/InertiaProp)
- [OptionalProp](classes/OptionalProp)
- [AlwaysProp](classes/AlwaysProp)
- [DeferProp](classes/DeferProp)
- [MergeProp](classes/MergeProp)
- [InfiniteScrollProp](classes/InfiniteScrollProp)
- [optional](functions/optional)
- [lazy](functions/lazy)
- [always](functions/always)
- [defer](functions/defer)
- [merge](functions/merge)
- [deepMerge](functions/deepMerge)
- [scroll](functions/scroll)
