All rules

Sheath rule

native-model-on-non-input

NativePHP model directives must target elements that can synchronize a changed value.
Package
NativePHP
Category
Native
Default severity
error by default
Auto-fix
Manual fix

#Why

Two-way binding requires an element that dispatches a change value. Layout, display, chrome, and child-component tags cannot establish that synchronization path.

#Examples

#Bad

{{-- column cannot emit the value needed for two-way binding. --}}
<native:column native:model="query">
<native:text>Search</native:text>
</native:column>

#Good

{{-- text-input can synchronize query on change. --}}
<native:text-input native:model.debounce.150ms="query" />
{{-- Legacy @model also works on a change-capable input. --}}
<native:toggle @model="enabled" />

#Supported Targets

Registered elements that expose compatible change handling can receive a model binding, including plugin elements.

Registered child components are rejected. Pass a prop and emit a custom event instead of using native:model on the component tag.

#Options

All NativePHP rules accept nativeViewPaths. The default is ['views/native/']. See Native View Detection for path configuration.

#See Also

Related rules validate the binding syntax and destination property: