AlpineJs Toggle

<div x-data="{ open: false }">
    <button @click="open = ! open"  @click.outside="open = false">Toggle</button>

    <div x-show="open">
        Contents...
    </div>
</div>