Input
Use .input() to define the properties passed into your component from the
outside. Two forms are available depending on whether you need runtime validation.
For simple cases where you just need type safety, pass a TypeScript generic directly — no extra dependencies required:
When you need runtime validation rules like min/max lengths, regex patterns, or conditional logic, pass any Standard Schema-compatible library instead — Zod, Valibot, and ArkType all work:
Once an input type is defined, the props become available as the first argument
to any builder method that accepts a callback — including .state(). This means
you can initialize state directly from an input value by passing a function
instead of a plain default:
Input values are passed to the component at the call site — in the example above,
the parent Pokedex passes { defaultPokemon: "charizard" } when rendering
PokemonPicker. With the schema form, if the value doesn't match the schema,
Ilha will throw at render time rather than silently passing invalid data into
your component.
Composition
The example above also demonstrates island composition. A parent island can
render a child island directly inside its html`` template by interpolating
it with${Child} or ${Child({ prop: value })}:
Each child manages its own state, lifecycle, and reactivity independently. The parent does not need to know anything about the child's internals — it only decides where the child appears. During SSR the child's HTML is rendered inline; on the client the child mounts into its own host element and activates independently.
Pokémon and PokéDex are trademarks of Nintendo/Creatures Inc./GAME FREAK inc. This tutorial uses the PokéAPI for educational purposes only and is not affiliated with or endorsed by the Pokémon Company.