Interaction
Turbo Frames
Render partial page updates into named Turbo frames.
Render a frame in a view
Wrap a view section in a Turbo frame:
{{ turbo_frame "post" . }}
That renders a frame element:
<turbo-frame id="post">...</turbo-frame>
Use a stable frame id that describes the replaceable region.
Add frame options
Frame helpers accept options:
{{ turbo_frame "post" . (turbo_src "/posts/hello-golazy") (turbo_loading "lazy") }}
This lets the browser load the frame lazily from another route.
Respond to frame requests
When Turbo sends a Turbo-Frame header, GoLazy can render a matching frame
partial without the full page layout:
func (c *PostsController) Show(_ http.ResponseWriter, _ *http.Request) error {
c.Set("post", post)
c.SetTurboFrameOptions(lazyturbo.Src("/posts/" + post.Param))
return c.Render("show")
}
The frame partial name is based on the frame id, such as:
app/views/posts/post_frame.html.tpl