Footer Navbar
The FooterNavbar component provides a responsive and customizable bottom navigation bar for applications, commonly used for primary navigation paths.
Installation
$ cbui-cli install @crossbuildui/footernavbar
To get started, please make sure you have installed
cbui-cli
globally and authenticated your account. This will ensure you can access all the necessary features.Import
MyComponent.tsx
1import { FooterNavbar } from '@/crossbuildui/footernavbar';
2import type { FooterNavbarItemConfig, FooterNavbarVariant, FooterNavbarColor, FooterNavbarSize, FooterNavbarRadius } from '@/crossbuildui/footernavbar';
3// import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; // Or your preferred icon library
4// import { View, Text } from 'react-native';
5// import { useSafeAreaInsets } from 'react-native-safe-area-context'; // If using safeAreaBottom
The
FooterNavbar
component uses:expo-blur
for theglass
variant.react-native-safe-area-context
ifsafeAreaBottom
is true.
react-native-vector-icons
) for the item icons.FooterNavbar Component
Props Overview
PROP | TYPE | DEFAULT | DESCRIPTION |
---|---|---|---|
items | FooterNavbarItemConfig[] | - | Array of item configurations. Required. |
variant | FooterNavbarVariant | 'solid' | Visual style of the navbar. |
color | FooterNavbarColor | 'background' | Base color for the navbar (background/border). |
size | FooterNavbarSize | 'md' | Size of the navbar and its items. |
radius | FooterNavbarRadius | 'none' | Top border radius of the navbar. |
hideLabels | boolean | false | If true, hides all item labels. |
activeItemColor | string | Theme's primary | Color for the active item's icon and label. |
inactiveItemColor | string | Theme's foreground | Color for inactive items' icon and label. |
onItemPress | (item, index) => void | - | Callback when an item is pressed. |
activeIndex | number | - | Controlled active item index. |
defaultActiveIndex | number | 0 | Initial active index (uncontrolled). |
style | StyleProp<ViewStyle> | - | Custom styles for the navbar container. |
itemStyle | StyleProp<ViewStyle> | - | Custom styles for each item's Pressable container. |
iconSize | number | - | Overrides default icon size derived from size . |
labelStyle | StyleProp<TextStyle> | - | Custom styles for item labels. |
safeAreaBottom | boolean | false | Add padding for bottom safe area insets. |
glassTint | 'default' | 'light' | 'dark' | Theme-derived | Tint for the 'glass' variant. |
glassIntensity | number | 80 | Intensity (0-100) for the 'glass' variant. |
FooterNavbarItemConfig Props
Each object in the items
array should conform to FooterNavbarItemConfig
:
PROP | TYPE | DESCRIPTION |
---|---|---|
id | string | Unique identifier for the item. Required. |
icon | (props: { color, size, isActive }) => ReactElement | Function returning an icon element. Required. |
label | string | Optional label text for the item. |
href | string | Optional href, passed to onItemPress . |
accessibilityLabel | string | Accessibility label for the item. |
pressableProps | PressableProps | Custom props for the item's Pressable component. |