uitab

Create tabbed panel

Description

t = uitab creates a tab inside a tab group and returns the Tab object. If there is no tab group available, MATLAB® calls the figure function to create a figure. Then it creates a tab group in that figure, and places the tab inside the tab group.

t = uitab(Name,Value) specifies tab property values using one or more name-value pair arguments.

t = uitab(parent) creates the tab in the specified parent container. The parent container can be a tab group in a figure created with either the figure or uifigure function. Property values for uitab vary slightly depending on whether the app is created with the figure or uifigure function. For more information, see Name-Value Pair Arguments.

example

t = uitab(parent,Name,Value) specifies the parent container and one or more properties values.

Examples

collapse all

Create a figure containing a tab group and two tabs.

f = figure;
tabgp = uitabgroup(f,'Position',[.05 .05 .3 .8]);
tab1 = uitab(tabgp,'Title','Settings');
tab2 = uitab(tabgp,'Title','Options');

Get the title of the first tab.

tab1.Title
ans =

Settings

The Scrollable property enables scrolling within a tab that has components outside its borders. Scrolling is only possible when the parent tab group is in a figure created with the uifigure function. App Designer uses this type of figure for creating apps.

Create a tab group containing one tab. Add six UI components to the tab, with the first three lying outside the upper border of the tab.

fig = uifigure;
tg = uitabgroup(fig,'Position',[20 20 196 145]);
t = uitab(tg,'Title','Member Information');
ef1 = uieditfield(t,'text','Position',[11 165 140 22],'Value','First Name');
ef2 = uieditfield(t,'text','Position',[11 140 140 22],'Value','Last Name');
ef3 = uieditfield(t,'text','Position',[11 115 140 22],'Value','Address');
dd = uidropdown(t,'Position',[11 90 140 22],'Items',{'Male','Female'});
cb = uicheckbox(t,'Position',[11 65 140 22],'Text','Member');
b = uibutton(t,'Position',[11 40 140 22],'Text','Send');

Enable scrolling by setting the Scrollable property of the tab to 'on'. By default, the scroll box displays at the top.

t.Scrollable = 'on';

Input Arguments

collapse all

Parent container, specified as a tab group. The tab group can be a child of a figure created with either the figure or uifigure function.

Name-Value Pair Arguments

Example: 'Title','Options' specifies that the tab title is Options.

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments as Name1,Value1,...,NameN,ValueN.

  • For a list of properties available for apps created with the uifigure function or in App Designer, see Tab Properties.

  • For a list of properties available for apps created with the figure function, see Tab Properties.

See Also

Functions

Properties

Introduced in R2014b