Use it when the structure should change.
A selected product can need a different detail section. A configuration can introduce more fields. A page can request that section after the relevant choice is known instead of assembling every possible branch at the start.
The host builds a Source fragment. The browser mounts the returned declarations using Gramlot’s normal rendering, bindings and lifecycle. The response is not an arbitrary HTML string that application code injects into the DOM.
Follow a request from selection to panel.
The target section keeps its initial content until the first fragment arrives. record_id is reactive: a changed selection requests the details again. One request runs at a time and its answer is mounted. The first trigger during that request waits with its arguments; further triggers are ignored while one is waiting. Removing the target cancels its request. Rapid edits can leave the mounted content behind current Data until another trigger.
details = pane.section("Waiting for the server")
details.remote("details", record_id="^.record_id")
@source
def details(self, root, record_id=None, **kwargs):
root.span(f"Record {record_id}")Read the explanation here. The working lesson and full contract are linked below.
Know what is fixed and what varies.
The method can be a literal name or a Data pointer. Prefer a clear, fixed method for this example and pass the selected record as a parameter. The host still checks the resolved method; a client-controlled name is not authorization. In Python the method is marked @source; JavaScript declares it through Page.registerSource.
The optional _cachedRemote avoids a duplicate request when the method and serialized parameters match the in-flight request or, when none is running, the last mounted fragment. It is a last-result optimization, not a general cache of every panel ever requested.
Choose Source or Data.
Use remote when the result you need is interface structure. Use an endpoint with dataRpc when you need a value for existing controls. Use dataRemote for an endpoint-backed value requested when its Data path is read.
In the browser/Worker profile, the local JavaScript host can build fragments too. “Remote” describes the request boundary; it does not guarantee that a network server is involved.