- Qt 6.9
- QDoc Manual
- Macros
- Tabbed Content
- Qt 6.9.0 Reference Documentation

Product Versions ◦ Linking to YouTube content

# Tabbed Content

Use the following macros to create tab groups of labeled HTML tabs that have comparable or alternative content. For example, you can show code snippets for different programming languages.

- \tab
- \tabcontent
- \endtabcontent

## Using Tab Macros

     \tab {name}{tab-id}{title}{checked}
     \tabcontent {tab-id}
       content
     \endtabcontent

Note: These macros only work with the online template, so you usually need to use conditional text to get good results also for the offline help.

For example, to show instructions for the CMake and qmake build systems in tabs:

     \if defined(onlinedocs)
       \tab {build-qt-app}{tab-cmake}{CMake}{checked}
       \tab {build-qt-app}{tab-qmake}{qmake}{}
       \tabcontent {tab-cmake}
     \else
       \section1 Using CMake
     \endif
       CMake-specific instructions go here
     \if defined(onlinedocs)
       \endtabcontent
       \tabcontent {tab-qmake}
     \else
       \section1 Using qmake
     \endif
       qmake-specific instructions go here
     \if defined(onlinedocs)
       \endtabcontent
     \endif

## \tab

     \tab {name}{tab-id}{title}{checked}

Specifies a tab in a tab group with a name, ID, title, and default state.

Use a unique name to specify which tabs belong to a tab group. That is, all tabs in a group have the same name. To separate the tabs from each other, give them each a unique tab-id within the group. Use this tab-id as the value of the \tabcontent macro to add content to the tab.

The checked argument selects the tab by default when the HTML page is loaded. For the initially hidden tabs, pass an empty argument {}.

## \tabcontent

     \tabcontent {tab-id}

Adds content to the tab with the tab-id you specify.

## \endtabcontent

Marks the end of the tab content that you begin with \tabcontent.

See also Macros.

Product Versions ◦ Linking to YouTube content