KVision
Primary version
Primary version
  • KVision Guide
  • Introduction
  • Migration
    • Migration from 8.x to 9.x
    • Migration from 7.x to 8.x
    • Migration from 6.x to 7.x
    • Migration from 5.x to 6.x
    • Migration from 4.x to 5.x
  • 1. Getting Started
    • Setting Up
    • Modules
    • Creating a New Application
    • Development Workflow
    • Hot Module Replacement
    • Debugging
    • Building For Production
  • 2. Frontend Development Guide
    • UI Structure
    • Root Container
    • Theming
    • Dark mode
    • Type safe CSS Properties
    • Basic Components
    • Icons and Images
    • Buttons and Toolbars
    • Layout Containers
    • Events
    • Working with State
    • DOM Bindings & Lifecycle Hooks
    • W3C, Snabdom, and KVision Elements
    • Forms
    • Form controls
    • Drag and drop
    • Internationalization
    • Adding custom tags (SVG example)
    • Custom components
  • 3. Optional UI Functionality (via modules)
    • Using Redux
    • Bootstrap
      • Navigation and menus
      • Tooltips and popovers
      • Modals, windows and toasts
    • Charts
    • Toasts
    • Tabulator Tables
    • Handlebars.js Templates
    • JS Routing with Navigo
    • jQuery Bindings
    • Using REST Services
  • 4. Integrating With Javascript Libraries
    • Integrating With React Components
  • 5. Fullstack Development Guide
    • Select Remote
    • Tom Select Remote
    • Tom Typeahead Remote
    • Tabulator Remote
  • FAQ
  • Useful References
Powered by GitBook
On this page
  • Buttons
  • Toolbars
  1. 2. Frontend Development Guide

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.

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.

toolbar {
    buttonGroup {
        button("<<")
    }
    buttonGroup {
        button("1", disabled = true)
        button("2")
        button("3")
    }
    buttonGroup {
        span("...")
    }
    buttonGroup {
        button("10")
    }
    buttonGroup {
        button(">>")
    }
}
PreviousIcons and ImagesNextLayout Containers

Last updated 1 year ago