import { ButtonGroup } from'stwui';
// ORimportButtonGroupfrom'stwui/button-group'; // for tree shaking
Basic
svelte
<script lang="ts">
import { ButtonGroup } from'stwui';
</script>
<ButtonGroup><ButtonGroup.Buttonon:click={() => console.log('button clicked!')}>
One
</ButtonGroup.Button><ButtonGroup.Buttonon:click={() => console.log('button clicked!')}>
Two
</ButtonGroup.Button><ButtonGroup.Buttonon:click={() => console.log('button clicked!')}>
Three
</ButtonGroup.Button></ButtonGroup>
With Active
svelte
<script lang="ts">
import { ButtonGroup } from'stwui';
let active = 1;
</script>
<ButtonGroup><ButtonGroup.Buttonon:click={() => active = 0} active={active === 0}>
One
</ButtonGroup.Button><ButtonGroup.Buttonon:click={() => active = 1} active={active === 1}>
Two
</ButtonGroup.Button><ButtonGroup.Buttonon:click={() => active = 2} active={active === 2}>
Three
</ButtonGroup.Button></ButtonGroup>
With Disabled
svelte
<script lang="ts">
import { ButtonGroup } from'stwui';
</script>
<ButtonGroup><ButtonGroup.Buttondisabled>
One
</ButtonGroup.Button><ButtonGroup.Button>
Two
</ButtonGroup.Button><ButtonGroup.Button>
Three
</ButtonGroup.Button></ButtonGroup>