View Source Inertia.HTML (Inertia v2.4.0)

HTML components for Inertia views.

Summary

Functions

Attributes

  • content (:list) (required) - The list of tags to inject into the head tag.

Renders a <title> tag that includes the inertia attribute needed for the Inertia.js client-side to subsequently manage the page title.

Functions

inertia_head(assigns)

Attributes

  • content (:list) (required) - The list of tags to inject into the head tag.

inertia_title(assigns)

Renders a <title> tag that includes the inertia attribute needed for the Inertia.js client-side to subsequently manage the page title.

The content you provide to this component will only apply to the initial server-rendered response. You will also need to use the client-side <Head> component in your Inertia page components to be sure the the page title is updated when internal navigation occurs.

If you are planning to manage page titles from the server-side, you may find it useful to expose the page_title via regular assigns (so your <.inertia_title> can use it) AND via Inertia page props (so your client-side <Head> use it):

def index(conn, _params)
  page_title = "Your page title"

  conn
  |> assign(:page_title, page_title)
  |> assign_prop(:page_title, page_title)
  |> render_inertia("YourPage")
end

Attributes

  • prefix (:string) - A prefix added before the content of inner_block. Defaults to nil.
  • suffix (:string) - A suffix added after the content of inner_block. Defaults to nil.

Slots

  • inner_block (required) - Content rendered inside the title tag.