@capawesome/capacitor-navigation-bar

中文文档
8.0.2发布于 2026/09/02MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 3795

Capacitor plugin to set the background color and button style of the navigation bar on Android.

原始使用文档
文档目录31 节
  1. Features
  2. Use Cases
  3. Compatibility
  4. Guides
  5. Installation
  6. Configuration
  7. Examples
  8. Usage
  9. Set the navigation bar color
  10. Set the button style
  11. Read the current color and style
  12. Hide and show the navigation bar
  13. API
  14. getColor()
  15. getStyle()
  16. hide()
  17. setColor(...)
  18. setStyle(...)
  19. show()
  20. Interfaces
  21. Enums
  22. FAQ
  23. Why are the setColor and setStyle methods not working on An…
  24. Why is this plugin not available on iOS?
  25. How do I make the navigation bar transparent?
  26. Can I apply a color and style at app launch?
  27. Can I use this plugin with Ionic, React, Vue or Angular?
  28. Related Plugins
  29. Newsletter
  30. Changelog
  31. License

Capacitor Navigation Bar Plugin

Capacitor plugin to set the background color and button style of the navigation bar.

Features

The Capacitor Navigation Bar plugin offers one of the most complete solutions for customizing the Android navigation bar in Capacitor apps. Here are some of the key features:

  • 🎨 Background color: Set the navigation bar background to any hex color or fully transparent.
  • 🔘 Button style: Choose dark or light navigation bar buttons, or follow the system appearance.
  • ➖ Divider color: Customize the navigation bar divider color on Android 9+.
  • 👁️ Visibility: Hide or show the navigation bar on demand.
  • ⚙️ Configuration: Apply defaults at app launch via the Capacitor configuration.
  • 🤝 Compatibility: Works alongside the Android Dark Mode Support, Android Edge-to-Edge Support and Home Indicator plugins.
  • 🔁 Up-to-date: Always supports the latest Capacitor version.
  • ⭐️ Support: Priority support from the Capawesome Team.
  • ✨ Handcrafted: Built from the ground up with care and expertise, not forked or AI-generated.

Missing a feature? Just open an issue and we'll take a look!

Use Cases

The Navigation Bar plugin is typically used to make the Android system navigation bar blend in with the app's design, for example:

  • Brand theming: Set the navigation bar background to your brand color so it matches the rest of your app.
  • Dark mode support: Switch the navigation bar color and button style when the user toggles between light and dark themes.
  • Immersive experiences: Hide the navigation bar for fullscreen content such as videos or games and show it again afterwards.
  • Consistent app launch: Apply a default color, divider color, and button style at app launch via the Capacitor configuration.

Compatibility

Plugin VersionCapacitor VersionStatus
8.x.x>=8.x.xActive support

Guides

Installation

You can use our AI-Assisted Setup to install the plugin. Add the Capawesome Skills to your AI tool using the following command:

npx skills add capawesome-team/skills --skill capacitor-plugins

Then use the following prompt:

 Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-navigation-bar` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands:

npm install @capawesome/capacitor-navigation-bar
npx cap sync

Configuration

PropTypeDescriptionSince
colorstringThe hexadecimal color to set as the background color of the navigation bar. Use 'transparent' to make the navigation bar transparent. Only available on Android.8.0.0
dividerColorstringThe hexadecimal color to set as the color of the navigation bar divider. Use 'transparent' to hide the divider. Only available on Android (API level 28+).8.0.0
style'DARK' | 'LIGHT' | 'DEFAULT'The style of the navigation bar buttons. Only available on Android.8.0.0

Examples

In capacitor.config.json:

{
  "plugins": {
    "NavigationBar": {
      "color": "#ffffff",
      "dividerColor": "#d9d9d9",
      "style": "LIGHT"
    }
  }
}

In capacitor.config.ts:

/// <reference types="@capawesome/capacitor-navigation-bar" />

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  plugins: {
    NavigationBar: {
      color: "#ffffff",
      dividerColor: "#d9d9d9",
      style: "LIGHT",
    },
  },
};

export default config;

Usage

The following examples show how to set the navigation bar color and button style, read the current color and style, and hide and show the navigation bar.

Set the navigation bar color

Set the background color of the navigation bar to any hexadecimal color, or pass 'transparent' to make it fully transparent. Only available on Android:

import { NavigationBar } from '@capawesome/capacitor-navigation-bar';

const setColor = async () => {
  await NavigationBar.setColor({ color: '#ffffff' });
};

Set the button style

Choose dark or light navigation bar buttons, or use Style.Default to follow the current device appearance. Only available on Android:

import { NavigationBar, Style } from '@capawesome/capacitor-navigation-bar';

const setStyle = async () => {
  await NavigationBar.setStyle({ style: Style.Light });
};

Read the current color and style

Get the current background color and button style of the navigation bar. Only available on Android:

import { NavigationBar } from '@capawesome/capacitor-navigation-bar';

const getColor = async () => {
  const { color } = await NavigationBar.getColor();
  return color;
};

const getStyle = async () => {
  const { style } = await NavigationBar.getStyle();
  return style;
};

Hide and show the navigation bar

Hide the navigation bar on demand, for example for fullscreen content, and show it again afterwards. Only available on Android:

import { NavigationBar } from '@capawesome/capacitor-navigation-bar';

const hide = async () => {
  await NavigationBar.hide();
};

const show = async () => {
  await NavigationBar.show();
};

API

getColor()

getColor() => Promise<GetColorResult>

Get the current background color of the navigation bar.

Only available on Android.

Returns: Promise<GetColorResult>

Since: 8.0.0


getStyle()

getStyle() => Promise<GetStyleResult>

Get the current style of the navigation bar buttons.

Only available on Android.

Returns: Promise<GetStyleResult>

Since: 8.0.0


hide()

hide() => Promise<void>

Hide the navigation bar.

Only available on Android.

Since: 8.0.0


setColor(...)

setColor(options: SetColorOptions) => Promise<void>

Set the background color of the navigation bar.

Only available on Android.

ParamType
optionsSetColorOptions

Since: 8.0.0


setStyle(...)

setStyle(options: SetStyleOptions) => Promise<void>

Set the style of the navigation bar buttons.

Only available on Android.

ParamType
optionsSetStyleOptions

Since: 8.0.0


show()

show() => Promise<void>

Show the navigation bar.

Only available on Android.

Since: 8.0.0


Interfaces

GetColorResult

PropTypeDescriptionSince
colorstringThe hexadecimal color of the navigation bar, or 'transparent' if the navigation bar is fully transparent.8.0.0

GetStyleResult

PropTypeDescriptionSince
styleStyleThe style of the navigation bar buttons.8.0.0

SetColorOptions

PropTypeDescriptionSince
colorstringThe hexadecimal color to set as the background color of the navigation bar. Use 'transparent' to make the navigation bar transparent.8.0.0
dividerColorstringThe hexadecimal color to set as the color of the navigation bar divider. Use 'transparent' to hide the divider. Only available on Android (API level 28+).8.0.0

SetStyleOptions

PropTypeDescriptionSince
styleStyleThe style of the navigation bar buttons.8.0.0

Enums

Style

MembersValueDescriptionSince
Dark'DARK'Light icons on a dark background.8.0.0
Default'DEFAULT'Resolved from the current device appearance.8.0.0
Light'LIGHT'Dark icons on a light background.8.0.0

FAQ

Why are the setColor and setStyle methods not working on Android 15+?

Starting with Android 15, the system enforces edge-to-edge display by default. In this mode the navigation bar is fully transparent and Window.setNavigationBarColor becomes a no-op, so setting the color through this plugin has no visible effect. If your app targets Android 15+ and you want to color the navigation bar area, use the @capawesome/capacitor-android-edge-to-edge-support plugin, which paints an overlay behind the navigation bar.

Why is this plugin not available on iOS?

iOS does not have a system navigation bar that can be customized in the same way as on Android. All methods of this plugin are therefore unimplemented on iOS and reject with an error.

How do I make the navigation bar transparent?

Pass 'transparent' as the color to the setColor method or use it as the color value in the Capacitor configuration. You can also pass 'transparent' as the dividerColor to hide the navigation bar divider.

Can I apply a color and style at app launch?

Yes, you can define the color, dividerColor, and style properties in the NavigationBar section of your Capacitor configuration file. The plugin applies these defaults when the app launches, so you don't have to call setColor or setStyle manually. See the Configuration section for examples.

Can I use this plugin with Ionic, React, Vue or Angular?

Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.

Newsletter

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our Capawesome Newsletter.

Changelog

See CHANGELOG.md.

License

See LICENSE.

版本与发布记录

@capawesome/capacitor-navigation-bar 共发布 4 个版本,首次发布于 2026/05/27;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.0.2latest2026/09/022 个月前
8.0.12026/07/153 个月前
8.0.02026/05/275 个月前
7.0.0-dev.2fed8fd6.1779871806dev2026/05/275 个月前

关于 @capawesome/capacitor-navigation-bar 的常见问题

@capawesome/capacitor-navigation-bar 是什么?

Capacitor plugin to set the background color and button style of the navigation bar on Android.

如何安装 @capawesome/capacitor-navigation-bar?

在项目目录运行 npm install @capawesome/capacitor-navigation-bar,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@capawesome/capacitor-navigation-bar 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capawesome/capacitor-navigation-bar 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capawesome/capacitor-navigation-bar 可以商用吗?

@capawesome/capacitor-navigation-bar 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@capawesome/capacitor-navigation-bar 的下载量有多少?

根据 npm 官方下载统计,@capawesome/capacitor-navigation-bar 在 2026/10/09 – 2026/11/07 这 30 天内被下载 3,795 次,日均约 127 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capawesome/capacitor-navigation-bar 还在维护吗?

最新版本 8.0.2 发布于 2026/09/02(2 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/05/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。