AvalonAvalon
GitHub

island prop

Complete reference for the island prop API.

Type definition

interface IslandProp {
  condition?: IslandCondition;
  id?: string;
  conditionArg?: string;
}

type IslandCondition =
  | 'on:client'
  | 'on:visible'
  | 'on:interaction'
  | 'on:idle'
  | `media:${string}`
  | `on:${string}`;  // custom directives

Properties

PropertyTypeDefaultDescription
conditionIslandCondition'on:client'When the island hydrates
idstringAuto-generatedStable identifier for state persistence
conditionArgstringundefinedArgument passed to custom directives

Valid condition values

ValueTrigger
on:clientImmediately on page load
on:visibleElement enters the viewport
on:interactionFirst click or hover
on:idleBrowser idle time
media:(query)CSS media query matches
on:delayAfter a timeout (ms)
on:scrollPage scrolled past threshold (px)
on:eventCustom DOM event fires
on:matchMedia query matches via directive
on:<custom>Any registered custom directive

Usage

<Counter island={{ condition: 'on:interaction' }} />

<Widget island={{ condition: 'on:delay', conditionArg: '2000' }} />

<Counter island={{ condition: 'on:client', id: 'hero-counter' }} />

Props must be serializable to JSON — they are embedded in the HTML as a data attribute for hydration.

See also