Skip to content

Navbar Button Component ​

The NavbarButtonComponent provides native navigation bar button support with badges and interactions.

Basic Info ​

Description ​

This component renders buttons in the native navigation bar with badge support and custom actions.

How to Use ​

1. Web Implementation ​

javascript
import { useNavbarButton } from '@bagisto-native/react';

const NavbarButton = ({ type, onClick }) => {
    const { buttonProps, setBadge, clearBadge } = useNavbarButton({
        position: "right", // "left" or "right"
        icon: "cart", // Icon name
        badge: 0, // Badge count (0 = hidden)
        haptic: true,
        onPress: onClick
    });

    // Update badge programmatically
    useEffect(() => {
        setBadge(5); // Show badge with 5
    }, []);

    return null; // Button is rendered in native navbar
};

2. Native Side ​

kotlin
navigator.registerBridgeComponent("navbarButton", NavbarButtonComponent(this))

API Reference ​

PropertyTypeRequiredDescription
positionStringYes"left" or "right"
iconStringYesIcon name
badgeNumberNoBadge count (0 hides)
hapticBooleanNoEnable haptic feedback
onPressFunctionNoPress callback
setBadge(count)FunctionNoProgrammatically set badge
clearBadge()FunctionNoClear badge

Available Icons ​

Icon NameDescription
cartShopping cart
searchSearch icon
menuMenu icon
backBack arrow
closeClose icon
filterFilter icon
heartWishlist icon
userProfile icon

Use Cases ​

  • Cart button with item count badge
  • Search button in navigation
  • Filter toggle button
  • Profile access button

Next Steps ​

Released under the MIT License.