Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Get something like overflow-Event
Hi,
i am trying to set up a Button bar which does not have a specific with.
It is set to 100% by the parent component.
Now i have somethin like a bar of buttons where multiple buttons are added,
but at some point the buttons will ether overflow or there will be a scrollbar, but i would like to have another solution where a button pops up to show "more buttons availible" and no overflow and no scrollbar should be visible.
But can't find any resources on that one.
Here is a quick example:
ButtonBar bar = new ButtonBar();
bar.setWith("100%");
//add some buttons
public class ButtonBar extends VerticalLayout{
private ArrayList<Button> someMore;
private Button moreButtons;
public ButtonBar(){
someMore = new ArrayListButton<>();
moreButtons.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
//show smoeMore Buttons in something like a dropdown
}
});
addComponent(moreButtons);
}
public void addButton(Button btn){
boolean doesFitInLayout = ???;
if(doesFitInLayout){
addComponent(btn, getComponentCount()-1);
}else{
someMore.add(btn);
}
}
}
Thanks for your help and ideas
greetings Michael
Hi,
You could use the MenuBar component, which does exactly this (collapses the options that do not fit in the layout to a dropdown. Resize the browser to see it happen: https://demo.vaadin.com/valo-theme/#!menubars
Thats quite a good idea - i will give this a try.
Thanks you.