npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

capacitor-native-tabbar

v0.0.3

Published

Native tab bar for Capacitor apps — UITabBar on iOS, BottomNavigationView on Android, overlays the WebView

Readme

Capacitor Native Tab Bar

English


Возможности

  • Нативный UIUITabBar на iOS, BottomNavigationView на Android
  • Гибкие иконки — из ресурсов ({id}.png, {id}_active.png) или base64
  • Цвета — цвета лейбла для активного/неактивного состояния
  • Safe area — учитывает нижнюю безопасную зону (вырез, жесты)
  • Web fallback — работает в браузере при разработке

Установка

npm install capacitor-native-tabbar
# или
yarn add capacitor-native-tabbar

Синхронизация нативных проектов:

npx cap sync

Быстрый старт

import { CapTabbar } from 'capacitor-native-tabbar';

// Инициализировать (создать) таб-бар
CapTabbar.init({
  tabs: [
    { id: 'home', label: 'Главная' },
    { id: 'search', label: 'Поиск' },
    { id: 'profile', label: 'Профиль' },
  ],
  selectedId: 'home',
  label_color: '#000000',
  label_color_active: '#007AFF',
});

// Слушать смену вкладки
CapTabbar.addListener('tabChange', (event) => {
  console.log('Выбрана вкладка:', event.tabId);
});

// Получить текущее состояние
const { initialized, visible, activeTabId } = await CapTabbar.getState();

// Скрыть / показать UI (таб-бар остаётся в памяти)
CapTabbar.hide();
CapTabbar.show();

// Полностью удалить таб-бар
CapTabbar.destroy();

Иконки

Два варианта (base64 имеет приоритет):

Вариант 1: Base64

{
  id: 'fav',
  label: 'Избранное',
  base64_icon: 'iVBORw0KGgo...',
  base64_active_icon: 'iVBORw0KGgo...',
}

Вариант 2: Ресурсы нативного проекта

Положите иконки по id таба:

| Таб (id) | Обычная | Активная | |----------|-------------|------------------| | home | home.png | home_active.png|

Android: android/app/src/main/res/drawable/
iOS: ios/App/App/Assets.xcassets/ — Image Sets home, home_active

Поддерживаются PNG и vector drawable (.xml) на Android. Пробелы и дефисы в id заменяйте подчёркиванием в имени файла. При отсутствии иконки показывается заглушка.

Цвета лейбла

CapTabbar.init({
  tabs,
  selectedId: 'home',
  label_color: '#666666',        // неактивный
  label_color_active: '#007AFF', // активный
});

API

init(options)

Инициализировать (создать) таб-бар с заданной конфигурацией.

init(options: InitOptions) => Promise<void>

destroy()

Полностью удалить таб-бар.

destroy() => Promise<void>

show()

Показать UI таб-бара (сделать видимым). Таб-бар должен быть инициализирован.

show() => Promise<void>

hide()

Скрыть UI таб-бара (сделать невидимым). Таб-бар остаётся в памяти.

hide() => Promise<void>

setSelectedTab(options)

Программно переключить вкладку.

setSelectedTab(options: SetSelectedTabOptions) => Promise<void>

getState()

Вернуть текущее состояние: инициализирован ли, виден ли таб-бар и id активной вкладки.

getState() => Promise<{ initialized: boolean, visible: boolean, activeTabId: string }>

addListener('tabChange', listenerFunc)

Подписка на смену вкладки при нажатии пользователя.

addListener(eventName: 'tabChange', listenerFunc: (event: TabChangeEvent) => void) => Promise<{ remove: () => Promise<void> }>

Интерфейсы

InitOptions: tabs, selectedId, label_color?, label_color_active?, android?

AndroidTabbarStyleOptions (только Android):

  • background_color? — цвет фона таббара (hex).
  • elevation_dp? — elevation (тень) в dp. Если не задано — по умолчанию темы/платформы. 0 отключает elevation.
  • ripple_color? — цвет ripple/нажатия (hex).
  • icon_tint_inactive? — tint иконок для неактивного состояния (hex).
  • icon_tint_active? — tint иконок для активного состояния (hex).
  • top_divider_color? — цвет верхнего разделителя (hex). Если задан — добавляется тонкая линия сверху таббара.
  • top_divider_height_dp? — высота разделителя в dp (по умолчанию 1dp, если divider включён).

TabItem: id, label, base64_icon?, base64_active_icon?

SetSelectedTabOptions: tabId

GetStateResult: initialized, visible, activeTabId

TabChangeEvent: tabId

Лицензия

MIT © Anton Seagull