How to add button to Panel caption region

Does any one know how to add one customized button to the Panel caption area?

35703.png

Hi,

one option would be to wrap the Panel with a VerticalLayout, which also contains the Button and has no Margin or Spacing.

-Olli

Hi,
Thanks for your reply.
If I put one button and panel into the vertical layout, the button will be just next to the panel, but it is not inside the panel caption region.

​What I want is to put one button inside the caption region of the panel.

​Any suggestion will be approciated.

Hi,

in that case, I think you’ll need to some more convoluted layouting tricks to make it work from the server side. Maybe you could wrap the Panel in a CssLayout instead and add the use CSS to position the Button (also inside the CssLayout) with position: absolute and margins over the caption? If that’s not good either, I think you’ll need to create a client-side extension. This add-on does something similar, but with a Window: https://vaadin.com/directory#!addon/window-header-extension

-Olli

Hi Olli,

​Thank you very much, I will have a try about the client-side extension.