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)

12 APIs That You Will Love

Free and easy to use APIs for your next project, learning a new technology, or building a new feature.