1
votes

I have a MenuButton https://openui5.hana.ondemand.com/explored.html#/entity/sap.m.MenuButton/samples in a bar with long text property value.

I would like to set width of the MenuButton in order to show all the text.
If I set width property, I can set (reduce) length (2px, 5px, 15px...) but increasing over a threshold the button remain to a fixed max size.

1

1 Answers

1
votes

It's kind of an overkill but if you want to avoid using custom CSS classes, you could wrap the MenuButton with a flexbox control (with renderType="Bare") and override max-width (or set min-width) by using FlexItemData as a layoutData.

<HBox renderType="Bare">
  <MenuButton text="Hello World" width="600px">
    <layoutData>
      <FlexItemData maxWidth="100%"/>
    </layoutData>
  </MenuButton>
</HBox>

Overriding max-width of sap.m.MenuButton with FlexItemData


PS: The max-width of sap.m.MenuButton was indeed not documented. After filing an issue, the API reference now mentions that it has a max-width.

As per visual design this width can be maximum of 12rem (192px)