alpine-turbo-drive-adapter
Version:
Bridge library to enable full support for Alpine components in pages using Turbolinks/Turbo Drive
21 lines (18 loc) • 629 B
HTML
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@hotwired/turbo/dist/turbo.es2017-umd.min.js"></script>
<script src="/dist/alpine-turbo-drive-adapter.js" defer></script>
<script src="//unpkg.com/alpinejs" defer></script>
<meta name="turbo-refresh-method" content="morph">
</head>
<body>
<div x-data="{foo: 'abc'}">
<span x-text="foo"></span>
<p x-show="foo === 'success'" x-cloak>I'm hidden at first</p>
<button @click="foo = 'something else'">Change Text</button>
</div>
<form method="post" action="/morph">
<input type="submit">
</form>
</body>
</html>