CaptionPositions add-on - Vaadin Add-on Directory
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);
```
Online DemoIssue Tracker
Source Code