New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

reactjs-bottom-navigation

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactjs-bottom-navigation

A flexible bottom navigation component for React applications

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
148
increased by92.21%
Maintainers
0
Weekly downloads
 
Created
Source

reactjs-bottom-navigation

React bottom navigation component

JavaScript Style Guide npm NPM Downloads

Table of Contents

Introduction

Preview

"ReactJS Bottom Navigation" is a lightweight and flexible component that provides a customizable bottom navigation experience for your React applications. This component has been fully re-implemented in TypeScript in version 2, providing a more robust and type-safe development experience. With a range of options to customize it.

Installation

npm install --save reactjs-bottom-navigation

Props

PropsTypeDefaultDescription
itemsBottomNavigationItem[]-The array of items to display in the navigation
selectednumbernull(optional) The index of the currently selected item
onItemClickfunction-(optional) Triggered when an item is clicked, returns the clicked item
activeBgColorstring-(optional) Custom active background color code
activeTextColorstringblack(optional) Custom active text color code
hideOnScrollbooleanfalse(optional) Hides the navigation bar when scrolling
styleReact.CSSProperties{}(optional) Custom styles for the navigation container
classNamestring""(optional) Custom class name for the navigation container

Item Structure

All item properties are optional. If no property is provided, the item will occupy space but remain empty.

PropTypeDescription
titlestring(optional) Item title
iconJSX.Element(optional) Item icon
activeIconJSX.Element(optional) Item active icon
onClickfunction(optional) Triggered when the item is clicked, returns the clicked item
render({ isActive: boolean; id: number }) => JSX.Element(optional) Custom render function for the item
activeboolean(optional) Custom active state control. If not provided, falls back to selected index behavior

Usage

To use the component, provide an array of items representing the navigation options in the bar. Each item can include a title, an icon, or custom content using the render function.

Example:

import React, { useState } from "react";
import { BottomNavigation } from "reactjs-bottom-navigation";

function App() {
  const bottomNavItems = [
    {
      title: "Home",
      onClick: ({ id }) => alert("Menu clicked " + id),
      icon: <HomeIcon />,
      activeIcon: <HomeIcon color="#fff" />
    },
    {
      title: "Search",
    },
    {
      render: ({ isActive, id }) => isActive ? <strong>{id}</strong> : <span>{id}</span>,
    },
  ];

  return (
    <div>
      <BottomNavigation
        items={bottomNavItems}
        selected={0}
        onItemClick={(item) => console.log(item)}
        activeBgColor="slateBlue"
        activeTextColor="white"
        hideOnScroll={true}
        className="custom-bottom-nav"
        style={{ position: "fixed", bottom: 0, width: "100%" }}
      />
    </div>
  );
}

export default App;

Customization

The component offers multiple ways to customize:

Styles and Classes

  • Navigation container: bottom-nav
  • Navigation items: bottom-nav-item
  • Item titles: bottom-nav-item-title
  • Active items: Add active class to bottom-nav-item

You can use activeBgColor, activeTextColor, and the className prop to further customize the appearance.

Hide on Scroll

Use the hideOnScroll prop to automatically hide the navigation bar when scrolling down.

Custom Content

Use the render method in items to define custom content for each navigation item.

License

MIT © hoseinhamzei

Keywords

FAQs

Package last updated on 16 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc