Loading SvelteCosmos...
“In Svelte 5, component inputs are declared with let { propName = defaultValue, ...rest } = $props(). For two-way data contracts, $bindable() explicitly opts a property into two-way binding.”
Type-safe component properties with default values, rest attributes, and two-way contracts.
<script>
interface Props {
label: string;
value?: string;
}
let { label, value = $bindable('') }: Props = $props();
</script>
<label>{label}</label>
<input bind:value={value} />Modify the state variable below to watch the signal update the output without VDOM diffing:
Unbound props are static parameter references, completely bypassing proxy overhead.