Main Content

disableLegacyPadding

Increase padding in panel UI container

Since R2025a

    Description

    disableLegacyPadding(p) slightly increases the padding around the title and inside borders of the specified panel.

    In most cases, you do not need to use this function. By default, legacy padding is enabled for panels in figure-based apps and disabled for panels in uifigure-based apps. If you have a figure-based app and want additional panel padding, disableLegacyPadding updates the spacing of panel elements to match that of panels in uifigure-based apps.

    example

    disableLegacyPadding(fig) updates the padding of all the panels contained in the specified figure.

    Examples

    collapse all

    Create an app that contains a panel with some UI components. The components extend slightly outside the interior area of the panel.

    fig = uifigure(Position=[100 100 500 300]);
    fig.Position = [100 100 500 300];
    pnl = uipanel(fig,Position=[10 10 480 280],Title="My Panel");
    tg = uitabgroup(pnl,Position=[10 24 460 240]);
    t1 = uitab(tg,Title="Tab 1");
    t2 = uitab(tg,Title="Tab 2");
    b = uibutton(pnl,Text="Plot Data",Position=[200 0 80 22]);

    Figure contains an object of type uipanel.

    Enable legacy padding for the panel. The components fit entirely inside the interior area.

    enableLegacyPadding(pnl)

    Figure contains an object of type uipanel.

    Revert the panel padding changes.

    disableLegacyPadding(pnl)

    Figure contains an object of type uipanel.

    Input Arguments

    collapse all

    Panel UI container, specified as a Panel object created using the uipanel function.

    Figure, specified as a Figure object. disableLegacyPadding updates the padding for all panels in the figure.

    Version History

    Introduced in R2025a