Home

Awesome

Karibu-Tools: The Vaadin Missing Utilities

GitHub tag Maven Central CI

Utility functions missing from Vaadin 14+, for your Kotlin-based projects.

The jar is in Maven Central, so it's easy to add this library to your project.

Gradle:

repositories {
  mavenCentral()
}
dependencies {
  api("com.github.mvysny.karibu-tools:karibu-tools:x.y")
}

Note: for Vaadin 23+, depend on karibu-tools-23 instead, to bring some additional utilities.

See the tag above for the latest version.

General Vaadin Utilities

A set of general Vaadin utilities applicable to all components.

Obtaining Vaadin version at runtime

Events

Component hierarchy

Misc Component

Misc Element

Router

Navigating:

QueryParameters:

Time Zone

In order to properly display LocalDate and LocalDateTime on client's machine, you need to fetch the browser's TimeZone first. You can achieve that simply by calling BrowserTimeZone.fetch(), for example when the Vaadin UI is being initialized. fetch() will request the information from the browser and will store it into the session. Afterwards, simply call BrowserTimeZone.get to get the browser's time zone instantly.

Text selection utils

The following functions are applicable to any field that edits text, e.g. TextField, TextArea, EmailField:

DataProviders

Grid

Keyboard Shortcuts

Make sure you use these imports:

import com.vaadin.flow.component.Key.*

Then:

Make sure to read the Safe JavaScript Keyboard shortcuts article before designing shortcuts for your app.

MenuBar

Icon

To use custom icons with Vaadin 14+, see Custom Icons With Vaadin 14.

Dialogs

Button

Notification

PageConfigurator

PageConfigurator is now deprecated, the suggestion is to use BootstrapListener but there are no utility methods to add meta tags etc! Therefore we introduce the following utility methods (see examples below):

class MyServiceInitListener : VaadinServiceInitListener {
    override fun serviceInit(event: ServiceInitEvent) {
        event.addBootstrapListener {
            it.document.head().addMetaTag("apple-mobile-web-app-capable", "yes")
            it.document.head().addMetaTag("apple-mobile-web-app-status-bar-style", "black")
        }
    }
}

Upload

LoginForm/LoginOverlay

RadioButtonGroup

HTML

The HtmlSpan component (since 0.6) has an advantage over Vaadin-provided Html - it will accept any HTML snippet and will set it as an innerHTML to a <span> element.

ComboBox

DatePicker

Select

ListBox

Validators

TabSheet

Since 0.18; depend on karibu-tools-23 to gain access to these utility functions.

Java: use TabSheetsKt.getTab() etc.

License

Licensed under Apache 2.0

Copyright 2021-2022 Martin Vysny

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributing / Developing

See Contributing.