DEV Community

TheComputerM
TheComputerM

Posted on

3 1

How to create Item and Button Groups in Svelte efficiently.

You can create button groups with the use of setContext and getContext and slots. See the REPL.

You will get something like this.

<ButtonGroup>
    <Button value="foo">
        Foo
    </Button>
    <Button value="bar">
        Bar
    </Button>
    <Button value="baz">
        Baz
    </Button>
</ButtonGroup>
Enter fullscreen mode Exit fullscreen mode

Here is the REPL

Top comments (0)

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay