DEV Community

loading...

How to create Item and Button Groups in Svelte efficiently.

thecomputerm profile image TheComputerM ・1 min read

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>

Here is the REPL

Discussion

pic
Editor guide