Directory

← Back

CaptionPositions add-on

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

Author

Contributors

Rating

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);

Sample code

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);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2016-12-29
Maturity
BETA
License
Apache License 2.0

Compatibility

Framework
Vaadin 8.0+
Vaadin 7.0+ in 1.0.0
Browser
Browser Independent
Online