Understanding $el, $refs, and $root
$el: The Current TrackRefers to the element the directive is on. It's like a channel strip button that only affects its own track.
Status:
<button @click="soloTrack($el)">Solo</button>
$refs: Named EquipmentAccess other elements by name within the component. It's like a mixing console controlling specific, labeled gear.
Status:
<div x-ref="compressor">...</div>
<button @click="$refs.compressor.toggle()">...</button>
$root: The Entire StudioRefers to the root element of the Alpine component. It's the master switch that affects the whole studio at once.
Note: The effect is applied to the main component container, indicated by the border.
Status:
<div x-data>
<button @click="$root.classList.add('...')">
</div>
No actions yet. Interact with the demos above.