Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series

$

49

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

A More Configurable Toggle

Here we will continue working with our toggle component to make it both look better and greatly improve the functionality.

Downloads

Become a pro to download code and videos

Comments

Mr customix

4 months ago

When I bind the switch to another variable I get a compiler error Although the site still works Browser error: <Toggle> was created with unknown prop 'toggl' typechecking error Type '{ toggl: boolean; }' is not assignable to type 'IntrinsicAttributes & { label?: string; isToggled?: boolean; style?: string; }'. Property 'toggl' does not exist on type 'IntrinsicAttributes & { label?: string; isToggled?: boolean; style?: string; }'.js(2322)

<script>
    let isToggled = false;
    let toggl = true;
</script>

<Accordion />
<Toggle bind:isToggled label="Beta" style="--togglebuttonColor: red;" />
<Toggle bind:toggl />

{#if isToggled}
<h1>I'm Toggled</h1>
{/if}

{#if toggl}
<h1>I'm Toggled</h1>
{/if}

Anyone have any solutions?

Want to join the conversation?

Become a Pro member today!