Skip to main content

TurboFrameRcController

Purpose

Remotely set the src of TurboFrames, and/or remotely clear their content.

Use Case 1: Modal form.

turbo_frame_rc_controller_example.gif

If you have an interactive widget/component wrapped in a turbo frame, you can use this links to swap out the frame widget, or selectively load/unload it.

Actions

ActionPurpose
setSrcSets the src of the remote <TurboFrame> to the specified value, triggering a content load
clearClear the src of the remote <TurboFrame>, and remove its innerHTML
toggleIf the src is empty, or different to the current specified value, calls setSrc. Otherwise, calls clear

Targets

TargetPurposeDefault
---

Classes

ClassPurposeDefault
---

Values

ValueTypeDescriptionDefault
frameIdStringThe ID of the frame to drive-
src (Optional)StringThe URL set the remote frame's src toIf the controller root element is an <a>, the href of the element. Otherwise, throws an error.
loadingMessage (Optional)StringThe message to display while content is loading-

Events

EventWhenDispatched onevent.detail
----

Side Effects

None

How to Use

HTML

Example WIP