<div x-data="{ showBox: true }">
    <button @click="showBox = !showBox">Toggle</button>
    <div x-show="showBox" style="width:50px; height:50px; background:red"></div>
</div>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js