Skip to content

BottomNavigationBar

A navigation bar typically displayed at the bottom of an app, allowing users to select between different views.

It supports both Material Design and iOS (Cupertino) styles via the variant prop.

Usage

🏠Home
💼Business
🎓School
Selected Index: 0
vue
<template>
  <div class="demo-container">
    <div style="margin-bottom: 20px; text-align: center">
      <Button @click="toggleVariant">
        <Text>Switch to {{ variant === "ios" ? "Material" : "iOS" }} Style</Text>
      </Button>
    </div>

    <Container :height="300" color="#f0f0f0" alignment="bottomCenter">
      <BottomNavigationBar :items="items" v-model:currentIndex="currentIndex" :variant="variant" />
    </Container>

    <div style="margin-top: 20px; text-align: center">
      <Text>Selected Index: {{ currentIndex }}</Text>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from "vue";
import { BottomNavigationBar, Container, Button, Text } from "fluekit";

const currentIndex = ref(0);
const variant = ref<"material" | "ios">("material");

const toggleVariant = () => {
  variant.value = variant.value === "material" ? "ios" : "material";
};

// Simple icon components for demo
const IconHome = { template: "<span>🏠</span>" };
const IconBusiness = { template: "<span>💼</span>" };
const IconSchool = { template: "<span>🎓</span>" };

const items = [
  { icon: IconHome, label: "Home" },
  { icon: IconBusiness, label: "Business" },
  { icon: IconSchool, label: "School" },
];
</script>

API

Props

NameTypeDefaultDescription
itemsBottomNavigationBarItem[]-The list of items to display in the navigation bar.
currentIndexnumber0The index of the currently selected item.
variant'material' | 'ios''material'The visual style of the navigation bar.
backgroundColorstring-Background color of the navigation bar.
selectedItemColorstring-Color of the selected item icon and label.
unselectedItemColorstring-Color of unselected items.
showSelectedLabelsbooleantrueWhether to show labels for selected items.
showUnselectedLabelsbooleantrueWhether to show labels for unselected items.
elevationnumber8The z-coordinate (shadow) of the navigation bar (Material only).

BottomNavigationBarItem

PropertyTypeDescription
iconComponentThe icon to display.
activeIconComponentThe icon to display when selected (optional).
labelstringThe text label for the item.

Events

NameDescriptionParameters
update:currentIndexEmitted when the selected index changes.index: number
tapEmitted when an item is tapped.index: number