
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
@rmwc/top-app-bar
Advanced tools
Top App Bar acts as a container for items such as application title, navigation icon, and action items.
Whats the difference between the TopAppBar and Toolbar? Toolbar is technically deprecated (although it still works just fine). TopAppBar functionality continues to be worked on by the material-components-web
team.
<>
<TopAppBar>
<TopAppBarRow>
<TopAppBarSection>
<TopAppBarTitle>Default</TopAppBarTitle>
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
<>
<TopAppBar>
<TopAppBarRow>
<TopAppBarSection alignStart>
<TopAppBarNavigationIcon icon="menu" />
<TopAppBarTitle>All Features</TopAppBarTitle>
</TopAppBarSection>
<TopAppBarSection alignEnd>
<TopAppBarActionItem icon="favorite" />
<TopAppBarActionItem icon="star" />
<TopAppBarActionItem icon="mood" />
</TopAppBarSection>
</TopAppBarRow>
<TopAppBarRow>
<TopAppBarSection alignStart>
<TopAppBarTitle>Another Row</TopAppBarTitle>
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
You can use the SimpleTopAppBar
component which contains a default template already laid out for you. Specify any actions you want as an array of props
<>
<SimpleTopAppBar
title="test"
navigationIcon
onNav={() => console.log('Navigate')}
actionItems={[
{
icon: 'file_download',
onClick: () => console.log('Do Something')
},
{ icon: 'print', onClick: () => console.log('Do Something') },
{ icon: 'bookmark', onClick: () => console.log('Do Something') }
]}
/>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
<>
<TopAppBar fixed>
<TopAppBarRow>
<TopAppBarSection>
<TopAppBarTitle>Fixed</TopAppBarTitle>
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
<>
<TopAppBar dense>
<TopAppBarRow>
<TopAppBarSection>
<TopAppBarTitle>Dense</TopAppBarTitle>
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
<>
{/** Additionally you can specify shortCollapsed to have it always minimized */}
<TopAppBar short>
<TopAppBarRow>
<TopAppBarSection>
<TopAppBarNavigationIcon icon="menu" />
<TopAppBarTitle>Short</TopAppBarTitle>
</TopAppBarSection>
<TopAppBarSection alignEnd>
<TopAppBarActionItem icon="favorite" />
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
<>
<TopAppBar prominent>
<TopAppBarRow>
<TopAppBarSection>
<TopAppBarTitle>Prominent</TopAppBarTitle>
</TopAppBarSection>
</TopAppBarRow>
</TopAppBar>
<TopAppBarFixedAdjust />
<div style={{ height: '100rem', padding: '1rem' }}>Scroll Me</div>
</>
TopAppBar
Name | Type | Description |
---|---|---|
dense | boolean | Styles the top app bar to be dense. |
fixed | boolean | Styles the top app bar as a fixed top app bar. |
foundationRef | Ref<null | MDCTopAppBarFoundation<>> | Advanced: A reference to the MDCFoundation. |
onNav | (evt: TopAppBarOnNavEventT) => void | Emits when the navigation icon is clicked. |
prominent | boolean | Styles the top app bar as a prominent top app bar. |
scrollTarget | null | Element<> | Set a scrollTarget other than the window when you are using the TopAppBar inside of a nested scrolling DOM Element. Please note that you should store your scrollTarget in a stateful variable. See example https://codesandbox.io/s/reverent-austin-16zzi. |
short | boolean | Styles the top app bar as a short top app bar. |
shortCollapsed | boolean | Styles the top app bar to always be collapsed. |
A row for the app bar.
A section for the app bar.
Name | Type | Description |
---|---|---|
alignEnd | boolean | Aligns the section to the end. |
alignStart | boolean | Aligns the section to the start. |
A title for the top app bar.
A navigation icon for the top app bar. This is an instance of the Icon component.
Action items for the top app bar. This is an instance of the Icon component.
An optional component to fill the space when the TopAppBar is fixed. Place it directly after the TopAppBar.
Name | Type | Description |
---|---|---|
dense | boolean | Class used to style the content below the dense top app bar to prevent the top app bar from covering it. |
denseProminent | boolean | Class used to style the content below the top app bar when styled as both prominent and dense, to prevent the top app bar from covering it. |
prominent | boolean | Class used to style the content below the prominent top app bar to prevent the top app bar from covering it. |
short | boolean | Class used to style the content below the short top app bar to prevent the top app bar from covering it. |
A simplified syntax for creating an AppBar.
Name | Type | Description |
---|---|---|
actionItems | Object[] | An array of props that will be used to create TopAppBarActionItems. |
dense | boolean | Styles the top app bar to be dense. |
endContent | ReactNode | Additional content to place in the end section. |
fixed | boolean | Styles the top app bar as a fixed top app bar. |
foundationRef | Ref<null | MDCTopAppBarFoundation<>> | Advanced: A reference to the MDCFoundation. |
navigationIcon | boolean | Object | Props for the NavigationIcon, which is an instance of the Icon component. You can also set this to |
true | ||
and use the | ||
onNav | ||
prop to handle interactions. | ||
onNav | (evt: TopAppBarOnNavEventT) => void | Emits when the navigation icon is clicked. |
prominent | boolean | Styles the top app bar as a prominent top app bar. |
scrollTarget | null | Element<> | Set a scrollTarget other than the window when you are using the TopAppBar inside of a nested scrolling DOM Element. Please note that you should store your scrollTarget in a stateful variable. See example https://codesandbox.io/s/reverent-austin-16zzi. |
short | boolean | Styles the top app bar as a short top app bar. |
shortCollapsed | boolean | Styles the top app bar to always be collapsed. |
startContent | ReactNode | Additional content to place in the start section. |
title | ReactNode | The title for the App Bar. |
FAQs
RMWC TopAppBar component
The npm package @rmwc/top-app-bar receives a total of 2,030 weekly downloads. As such, @rmwc/top-app-bar popularity was classified as popular.
We found that @rmwc/top-app-bar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.