> For the complete documentation index, see [llms.txt](https://kvision.gitbook.io/kvision-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kvision.gitbook.io/kvision-guide/2.-frontend-development-guide/buttons-and-toolbars.md).

# Buttons and Toolbars

## Buttons

KVision can render buttons in one of 17 styles (e.g. PRIMARY, SECONDARY, SUCCESS, INFO, WARNING, DANGER, LINK, LIGHT, DARK, OUTLINEPRIMARY, OUTLINESECONDARY, OUTLINESUCCESS, OUTLINEINFO, OUTLINEWARNING, OUTLINEDANGER, OUTLINELIGHT, OUTLINEDARK) and additional two sizes (LARGE, SMALL). Buttons can have a label as well as an icon or a custom image. The `io.kvision.html.Button` class offers a shortcut `onClick` method, which gives an easy way to bind a handler to the click event.

```kotlin
vPanel {
    button("Default button", style = ButtonStyle.PRIMARY) {
        onClick {
            println("Default button clicked")
        }
    }
    button("Cancel", "fas fa-times", ButtonStyle.WARNING) {
        size = ButtonSize.LARGE
        onClick {
            App.cancel()
        }
    }
}
```

### Toolbars

You can join some buttons together to create a button group and join some groups to create a toolbar. In KVision you use `io.kvision.toolbar.ButtonGroup` and `io.kvision.toolbar.Toolbar` classes for this purpose. Use DSL builders to easily create even complex toolbars.

```kotlin
toolbar {
    buttonGroup {
        button("<<")
    }
    buttonGroup {
        button("1", disabled = true)
        button("2")
        button("3")
    }
    buttonGroup {
        span("...")
    }
    buttonGroup {
        button("10")
    }
    buttonGroup {
        button(">>")
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://kvision.gitbook.io/kvision-guide/2.-frontend-development-guide/buttons-and-toolbars.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
