Guide › Interactivity

Islands

A component with a <script> is interactive: an island. It is rendered to HTML on the server like everything else, then attached in the browser: its event handlers and updates are wired to the HTML that is already there. Nothing re-renders.

<script>
  let count = state(0)
</script>

<button (click)="count++">Clicked {{ count }} times</button>

What ships to the browser

This page's text and layout ship no JavaScript. It loads two kinds of island: the theme toggle in the header, and the copy buttons on code samples, which use attach="interaction" so their code only loads when you click one.