Switch
A controlled element to represent "on" and "off" states.
Basic Example
<script>
import { Switch } from 'lithesome';
</script>
<Switch />
Native Input element
Since the <Switch />
component is rendering a button, you cannot use it for native form submissions.
If you want to use a native <input />
checkbox for forms, simply bind the checked from the button to the input.
<script>
import { Switch } from 'lithesome';
let checked = $state(false);
</script>
<form action="?/update" method="POST">
<Switch bind:checked />
<input type="checkbox" hidden bind:checked />
<button type="submit">Submit</button>
</form>