Skip to content

API reference ​

Everything inertia-ember exports, for an app whose server speaks Inertia. Each page has the signature, the options and standalone examples; the Guide explains the ideas behind them.

ts
import { createInertiaApp, Link, page, router, useForm } from 'inertia-ember';

Components ​

ExportDescription
LinkA link that makes an Inertia visit instead of a full page load. Non-GET links render a <button>.
HeadSets the document title and head tags, on the server too.
DeferredShows a fallback until deferred props arrive.
WhenVisibleLoads props when an element scrolls into view.
WhenMountedRenders its block only in the browser; server rendering shows the fallback.
InfiniteScrollLoads the next or previous page of a paginated prop as you scroll.
FormA form that sends its fields as an Inertia visit, reading them from the DOM by name.
AppThe root component createInertiaApp renders. You don't render it yourself.

Forms and HTTP ​

ExportDescription
useFormA form with tracked fields, errors and state, sent as an Inertia visit. Optional Precognition.
useHttpThe same fields, errors and state for plain JSON requests: the page stays put.
createFormReturns <Form> typed by its fields.
useFormContextThe API of the <Form> around an element, for components inside it.
InertiaFormThe class behind useForm's forms.
InertiaHttpThe class behind useHttp's clients.

Modifiers ​

ExportDescription
bind{{bind form 'field'}} connects an input, select or textarea to a form field.
inertia{{inertia}} turns any element into a link, with the same options as <Link>.

Hooks ​

Reactive helpers for a page's data. Most take the component that owns them and clean up when it's destroyed.

ExportDescription
usePollReloads the page, or some props, on an interval.
usePrefetchWhether the current page came from the prefetch cache, and flush().
usePropOne prop with its loading state.
useRememberA tracked object that survives back and forward navigation.
pageThe current page: props, URL, flash data. Tracked and read-only.
usePageThe current page, with its props typed.
setLayoutPropsHands props from a page up to its layouts.
resetLayoutPropsClears the props setLayoutProps set.

Setup ​

ExportDescription
createInertiaAppBoots the app in the browser, or returns the page renderer for server rendering.
createOwnerBuilds an Ember owner from your services, for @service in pages.
configInertia's global config: form and prefetch defaults, visitOptions.

Router and core re-exports ​

@inertiajs/core's own objects, re-exported. The full reference is at inertiajs.com.

ExportDescription
routerVisits, reloads, events, prefetching and client-side prop changes from code.
progressThe progress bar: start, set and finish it yourself.
httpThe HTTP client behind every request: request, response and error handlers, or a client of your own.
socketIdSends this tab's websocket id with each request, so broadcasts can skip it.

Types ​

ExportDescription
PageSignatureA page component's signature: typed @props for Glint.
LayoutSignatureA layout's signature: @props, @name and a block for the page.
PagePropsOfYour props plus the shared props and errors.
SharedPagePropsThe shared props, from your InertiaConfig.
Page, PageProps, Method, UrlMethodPair, FormDataConvertibleCore types, re-exported from @inertiajs/core.
LinkSignature, HeadSignature, DeferredSignature, WhenVisibleSignature, WhenMountedSignature, InfiniteScrollSignature, FormSignature, InertiaAppSignature, BindSignature, InertiaSignatureThe Glint signature of each component and modifier.
CreateInertiaAppOptions, AppOwner, PageRenderer, PageComponent, ResolvedPage, ModulesSetup types.
Poll, Prefetch, PropWhat the hooks return.
UseForm, FormSubmitOptions, UseHttp, HttpSubmitOptions, HttpOptimisticCallback, FormField, FormDataShape, OptimisticCallback, FormApi, LinkOptionsForm, HTTP and link types.

Other entry points ​

ImportExportsDescription
inertia-ember/serverrenderToString, createServerServer-side rendering. See On the server.
inertia-ember/viteember (default), frameworkThe Vite plugin for .gts files, and the page finder for @inertiajs/vite. See Installation.
inertia-ember/echoechoA live-props transport over Laravel Echo (Reverb, Pusher, Ably). See Live props.

Released under the MIT License.