JGuang

NavBar

NavBar · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

NavBar

Provides global navigation for pages.

Install

npm install antd-mobile@5.43.0

antd-mobile is for mobile web, not React Native or Mini Programs. React 19 projects must register createRoot with unstableSetRender at the entry, or imperative APIs such as Toast and Dialog cannot render. Switch dark mode with <html data-prefers-color-scheme="dark">.

Examples come from the official Ant Design Mobile repository (MIT) at the commit published as npm 5.43.0. Presentation helpers such as DemoBlock are JGuang rewrites, not antd-mobile APIs.

Provides global navigation for pages.

When to Use

Need to display the title and action of the current page content.

Demos

Props

NameDescriptionTypeDefault
backThe returned text of the area, if null returned, backIcon would not be renderedReacNode | null''
backIconWhether to display the back arrow icon of the return area, you can also pass in ReactNode for customizationboolean | ReactNodetrue
childrenTitleReactNode-
leftContent on the left, rendered on the right side of the return areaReactNode-
onBackCallback after clicking the return area() => void-
rightThe content of the right sideReactNode-

CSS Variables

NameDescriptionDefault
--border-bottomthe border bottom of the NavBarnone
--heightthe height of the Navbar45px