Skip to content

Template Attributes ​

Every trigger element must be inside some @linker('alias') mount point.

All attributes ​

AttributeEffect
@linker('alias')Mount point
data-linker-call="method"Which #[Computable] method to call
data-linker-args='{"id":3}'Arguments: a JSON literal
data-linker-args="form"Arguments: every field of the nearest <form> (file bytes excluded); name[] becomes an array
data-linker-args="keyword,tab"Arguments by name: a field with that name first, then client state
data-linker-value="user"Merge this element's own value into the arguments under this key
data-linker-extra='{"id":12}'Fixed values merged last; never overwritten by same-named fields
data-linker-on="input"Trigger event. Default: click for buttons, change for form elements; comma-separated for several
data-linker-debounce="400"Debounce in milliseconds
data-linker-confirm="Are you sure?"Confirm before sending
data-linker-confirm-dangerDestructive: danger style + must be clicked twice
data-linker-confirm-title / -labelCallout title and confirm button text
data-linker-confirm-target="#host"Which container the callout appears in
data-linker-refresh-on-reconnectRe-fetch when the connection comes back (reads only)

How arguments are built ​

blade
{{-- 1. Fixed JSON --}}
<button data-linker-call="show" data-linker-args='{"page":2}'>Page 2</button>

{{-- 2. A whole form --}}
<button type="button" data-linker-call="save" data-linker-args="form">Save</button>

{{-- 3. Named fields --}}
<input name="keyword" data-linker-call="search" data-linker-on="input"
       data-linker-debounce="400" data-linker-args="keyword">

{{-- 4. A few fields + an id the server already knows --}}
<button data-linker-call="update" data-linker-args="form" data-linker-extra='{"id": {{ $customer->id }}}'>Update</button>

{{-- 5. A select sending its own value --}}
<select data-linker-call="assign" data-linker-value="user" data-linker-extra='{"ticket": 7}'>…</select>

extra is not authorization

An id in data-linker-extra is still user-editable input. The server must check it with #[Authorize] or a policy.

Confirmation ​

blade
<button data-linker-call="delete"
        data-linker-args='{"id": 12}'
        data-linker-confirm="This can't be undone"
        data-linker-confirm-title="Delete customer"
        data-linker-confirm-label="Delete"
        data-linker-confirm-danger>Delete</button>

Several triggers on one element: @linkerBind ​

"Pre-check while typing, really submit on blur" needs different methods at different moments:

blade
<input name="keyword" @linkerBind([
    ['on' => 'input', 'call' => 'preview', 'debounce' => 300, 'args' => 'keyword'],
    ['on' => 'blur',  'call' => 'commit',  'args' => 'form'],
])>

It also works on Blade components (the component must output ):

blade
<x-forms.input-text name="keyword" @linkerBind([...]) />

Each entry can have its own args / value / extra / debounce / confirm / prevent. Because a PHP generator builds it, misspelled event names, method names or types throw when Blade renders.

RuleBehavior
Later cancels earlierA new trigger clears any debounce still pending on the same element
Timers are per bindingStored on the element, so bindings don't cancel each other
prevent defaults only for click and submitOther events keep their default behavior

Don't send pure front-end preprocessing through Linker

Formatting, character counts and previews are jobs for data-state-*. Keep a second binding for pre-checks that truly need the server (duplicates, prices). Otherwise Linker turns into a keyup handler.

Mount point and object are two different things ​

blade
<div @linker('customer') @renderObject('customerPanel', ['render', 'state:read', 'state:write'])>
  • @linker decides which component is called.
  • @renderObject decides whether this block may read/write state and render.

If the component's data is shown with data-state-text, or the pipeline uses state.set, you need the matching permission. You need both.