Vaadin Cookie Consent: By default, the banner is shown attached to the top of the screen and with a predefined text, a link to https://cookiesandyou.com describing cookies and a consent button. The texts, link and position can be configured.
Samples
Add cookie consent banner with default messages
import com.vaadin.flow.component.cookieconsent.CookieConsent;
public class DefaultSettings extends Div {
public DefaultSettings() {
add(new CookieConsent());
}
}
Add cookie consent banner with customized messages
import com.vaadin.flow.component.cookieconsent.CookieConsent;
public class CustomMessages extends Div {
public CustomMessages() {
final String message = "We are using cookies to make your visit here awesome!";
final String dismissLabel = "Cool!";
final String learnMoreLabel = "Why?";
final String learnMoreLink = "https://vaadin.com/terms-of-service";
final Position position = Position.BOTTOM_RIGHT;
final CookieConsent consent = new CookieConsent(message, dismissLabel, learnMoreLabel, learnMoreLink, position);
add(consent);
}
}