#[Ghost] attribute
Apply to a component class — no view changes required:
use Ghostwire\Attributes\Ghost;
#[Ghost(mode: 'synthesize', delay: 200, hold: 400)]class ProductTable extends Component{ // ...}Parameters
Section titled “Parameters”| Parameter | Type | Default | Meaning |
|---|---|---|---|
| mode | 'synthesize'|'freeze'|'off' | 'synthesize' | Loading strategy for this component |
| only | array<string>|null | null | Actions that activate the ghost |
| except | array<string>|null | null | Actions that never activate it |
| delay | int|null | null (package default: 120ms) | Delay before the ghost appears |
| hold | int|null | null (package default: 300ms) | Minimum visible duration |
| rows | int|null | null | Repeat-row hint for an empty host |
| poll | bool | false | Allow polled messages to activate the ghost |
| sync | bool | false | Allow property-only (sync) messages to activate it |
| lazy | bool | false | Reuse the learned tree as the lazy placeholder |
Precedence cascade
Section titled “Precedence cascade”Seven levels, most to least specific:
- Directive modifier on the element — e.g.
wire:ghost.freeze - Directive expression / action targeting — e.g.
wire:ghost="applyFilters" #[Ghost]on the executing action’s method#[Ghost]on the component class#[Ghost]inherited from a base class or traitconfig/ghostwire.php- Package defaults
The wire:ghost directive on the element outranks the #[Ghost] attribute: a directive-level setting overrides whatever the attribute levels declare, field by field. Any field a given level doesn’t declare falls through to the next. Inspect exactly which level decided a component’s live configuration with:
php artisan ghost:inspectMethod-level targeting
Section titled “Method-level targeting”#[Ghost(mode: 'freeze')]class ReportTable extends Component{ #[Ghost(mode: 'synthesize', delay: 50)] public function refresh() { /* ... */ }}refresh()’s own attribute overrides the class-level default for that action only.