mirror of https://github.com/sveltejs/svelte
21 lines
420 B
21 lines
420 B
<script>
|
|
let current = 'foo';
|
|
</script>
|
|
|
|
<button class:active={current === 'foo'} on:click={() => (current = 'foo')}>foo</button>
|
|
|
|
<button class:active={current === 'bar'} on:click={() => (current = 'bar')}>bar</button>
|
|
|
|
<button class:active={current === 'baz'} on:click={() => (current = 'baz')}>baz</button>
|
|
|
|
<style>
|
|
button {
|
|
display: block;
|
|
}
|
|
|
|
.active {
|
|
background-color: #ff3e00;
|
|
color: white;
|
|
}
|
|
</style>
|