DEV Community

TheComputerM
TheComputerM

Posted on

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)