| 1 | <html> |
| 2 | |
| 3 | <head> |
| 4 | <title>Example component or modal</title> |
| 5 | |
| 6 | <!-- Import the alpine store --> |
| 7 | <script type="module"> |
| 8 | import { store } from "/components/_examples/_example-store.js"; |
| 9 | </script> |
| 10 | </head> |
| 11 | |
| 12 | <body> |
| 13 | |
| 14 | <!-- This construct of x-data + x-if is used to ensure the component is only rendered when the store is available --> |
| 15 | <div x-data> |
| 16 | <template x-if="$store.exampleStore"> |
| 17 | |
| 18 | <!-- Keep in mind that <template> can have only one root element inside --> |
| 19 | <div> |
| 20 | <p x-text="$store.exampleStore.example1"></p> |
| 21 | <p x-text="$store.exampleStore.example2"></p> |
| 22 | </div> |
| 23 | |
| 24 | </template> |
| 25 | </div> |
| 26 | |
| 27 | <!-- Optional style for the component --> |
| 28 | <style> |
| 29 | #example-component { |
| 30 | width: 100%; |
| 31 | } |
| 32 | </style> |
| 33 | |
| 34 | </body> |
| 35 | |
| 36 | </html> |