Position component captions to left/right/top/bottom in HorizontalLayout and VerticalLayout

CaptionPositions is a layout extension add-on for Vaadin 7 and Vaadin 8.

It allows you to position the caption element of individual components inside VerticalLayout or HorizontalLayout to be either “top”, “right”, “bottom” or ”left”. It keeps any extra caption decorations (such as required field or error indicators) together with the caption (unline FormLayout for example, which moves the error indicator after the field).

Disclaimer: I’ve only tested the add-on with Vaadin 7.7.6 and 8.0.0-beta1. It should work with any Vaadin 7 or 8 version, but please let me know if it doesn’t.

Code example:

TextField input = new TextField("Caption");

VerticalLayout layout = new VerticalLayout();
layout.addComponent(input);

// Position the text input caption on the left side
CaptionPositions captionPositions = new CaptionPositions(layout);
captionPositions.setCaptionPosition(input, CaptionPosition.LEFT);

Install

Link to this version
StableReleased 29 December 2016Apache License 2.0
Framework Support
Vaadin 7.0+
Also supported:
Vaadin 8 (2.0.0)
Browser Independent
Install with
Release notes - Version 1.0.0