Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/BottomNavigation - added BottomNavigation with Example #1333

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
26 changes: 26 additions & 0 deletions apps/web/content/docs/components/bottom-navigation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: React Bottom Navigation - Flowbite
description: Use the bottom navigation bar component to allow users to navigate through your website or create a control bar using a menu that is positioned at the bottom of the page
---

The bottom bar component can be used to allow menu items and certain control actions to be performed by the user through the use of a fixed bar positioning on the bottom side of your page.

Check out multiple examples of the bottom navigation component based on various styles, controls, sizes, content and leverage the utility classes from Tailwind CSS to integrate into your own project.

## Default bottom navigation

Use the default bottom navigation bar example to show a list of menu items as buttons to allow the user to navigate through your website based on a fixed position. You can also use anchor tags instead of buttons.

<Example name="bottomNavigation.root" />

## Menu items with border

This example can be used to show a border between the menu items inside the bottom navigation bar.

<Example name="bottomNavigation.withBorder" />

## Example with Tooltip

This example can be used to show a Tooltip on the hover on the menu items.

<Example name="bottomNavigation.withTooltip" />
7 changes: 7 additions & 0 deletions apps/web/data/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ export const COMPONENTS_DATA: Component[] = [
link: "/docs/components/badge",
classes: "w-28",
},
{
name: "Bottom Navigation",
image: "/images/components/bottom-bar.svg",
imageDark: "/images/components/bottom-bar-dark.svg",
link: `/docs/components/bottom-navigation`,
classes: "w-28",
},
{
name: "Breadcrumbs",
image: "/images/components/breadcrumbs.svg",
Expand Down
1 change: 1 addition & 0 deletions apps/web/data/docs-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const DOCS_SIDEBAR: DocsSidebarSection[] = [
{ title: "Avatar", href: "/docs/components/avatar" },
{ title: "Badge", href: "/docs/components/badge" },
{ title: "Banner", href: "/docs/components/banner", isNew: true },
{ title: "Bottom Navigation", href: "/docs/components/bottom-navigation", isNew: true },
{ title: "Breadcrumb", href: "/docs/components/breadcrumb" },
{ title: "Button", href: "/docs/components/button" },
{ title: "Button group", href: "/docs/components/button-group" },
Expand Down
56 changes: 56 additions & 0 deletions apps/web/examples/bottomNavigation/bottomNavigation.root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"use client";

import { BottomNavigation } from "flowbite-react";
import { AiFillHome } from "react-icons/ai";
import { CgProfile } from "react-icons/cg";
import { GiSettingsKnobs, GiWallet } from "react-icons/gi";
import type { CodeData } from "~/components/code-demo";

const code = `
"use client";

import { BottomNavigation } from "flowbite-react";

function Component() {
return (
<BottomNavigation>
<BottomNavigation.Item label="Home" icon={AiFillHome} />
<BottomNavigation.Item label="Wallet" icon={GiWallet} />
<BottomNavigation.Item label="Settings" icon={GiSettingsKnobs} />
<BottomNavigation.Item label="Profile" icon={CgProfile} />
</BottomNavigation>
)
}
`;

function Component() {
return (
<div className="relative bottom-0 h-20">
<BottomNavigation
theme={{
root: {
base: "absolute bottom-0 left-0 z-50 h-16 w-full border-t border-gray-200 bg-white dark:border-gray-600 dark:bg-gray-700",
},
}}
>
<BottomNavigation.Item label="Home" icon={AiFillHome} />
<BottomNavigation.Item label="Wallet" icon={GiWallet} />
<BottomNavigation.Item label="Settings" icon={GiSettingsKnobs} />
<BottomNavigation.Item label="Profile" icon={CgProfile} />
</BottomNavigation>
</div>
);
}

export const root: CodeData = {
type: "single",
code: [
{
fileName: "client",
language: "tsx",
code,
},
],
githubSlug: "bottomNavigation/bottomNavigation.root.tsx",
component: <Component />,
};
57 changes: 57 additions & 0 deletions apps/web/examples/bottomNavigation/bottomNavigation.withBorder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"use client";

import { BottomNavigation } from "flowbite-react";
import { AiFillHome } from "react-icons/ai";
import { CgProfile } from "react-icons/cg";
import { GiSettingsKnobs, GiWallet } from "react-icons/gi";
import type { CodeData } from "~/components/code-demo";

const code = `
"use client";

import { BottomNavigation } from "flowbite-react";

function Component() {
return (
<BottomNavigation bordered>
<BottomNavigation.Item label="Home" icon={AiFillHome} />
<BottomNavigation.Item label="Wallet" icon={GiWallet} />
<BottomNavigation.Item label="Settings" icon={GiSettingsKnobs} />
<BottomNavigation.Item label="Profile" icon={CgProfile} />
</BottomNavigation>
)
}
`;

function Component() {
return (
<div className="relative bottom-0 h-20">
<BottomNavigation
theme={{
root: {
base: "absolute bottom-0 left-0 z-50 h-16 w-full border-t border-gray-200 bg-white dark:border-gray-600 dark:bg-gray-700",
},
}}
bordered
>
<BottomNavigation.Item label="Home" icon={AiFillHome} />
<BottomNavigation.Item label="Wallet" icon={GiWallet} />
<BottomNavigation.Item label="Settings" icon={GiSettingsKnobs} />
<BottomNavigation.Item label="Profile" icon={CgProfile} />
</BottomNavigation>
</div>
);
}

export const withBorder: CodeData = {
type: "single",
code: [
{
fileName: "client",
language: "tsx",
code,
},
],
githubSlug: "bottomNavigation/bottomNavigation.withBorder.tsx",
component: <Component />,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"use client";

import { BottomNavigation } from "flowbite-react";
import { AiFillHome } from "react-icons/ai";
import { CgProfile } from "react-icons/cg";
import { GiSettingsKnobs, GiWallet } from "react-icons/gi";
import type { CodeData } from "~/components/code-demo";

const code = `
"use client";

import { BottomNavigation } from "flowbite-react";

function Component() {
return (
<BottomNavigation>
<BottomNavigation.Item label="Home" icon={AiFillHome} showTooltip />
<BottomNavigation.Item label="Wallet" icon={GiWallet} showTooltip />
<BottomNavigation.Item label="Settings" icon={GiSettingsKnobs} showTooltip />
<BottomNavigation.Item label="Profile" icon={CgProfile} showTooltip />
</BottomNavigation>
)
}
`;

function Component() {
return (
<div className="relative bottom-0 h-20">
<BottomNavigation
theme={{
root: {
base: "absolute bottom-0 left-0 z-50 h-16 w-full border-t border-gray-200 bg-white dark:border-gray-600 dark:bg-gray-700",
},
}}
>
<BottomNavigation.Item label="Home" icon={AiFillHome} showTooltip />
<BottomNavigation.Item label="Wallet" icon={GiWallet} showTooltip />
<BottomNavigation.Item label="Settings" icon={GiSettingsKnobs} showTooltip />
<BottomNavigation.Item label="Profile" icon={CgProfile} showTooltip />
</BottomNavigation>
</div>
);
}

export const withTooltip: CodeData = {
type: "single",
code: [
{
fileName: "client",
language: "tsx",
code,
},
],
githubSlug: "bottomNavigation/bottomNavigation.withBorder.tsx",
component: <Component />,
};
dhavalveera marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions apps/web/examples/bottomNavigation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { root } from "./bottomNavigation.root";
export { withBorder } from "./bottomNavigation.withBorder";
export { withTooltip } from "./bottomNavigation.withTooltip";
1 change: 1 addition & 0 deletions apps/web/examples/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * as avatar from "./avatar";
export * as badge from "./badge";
export * as banner from "./banner";
export * as blockquote from "./blockquote";
export * as bottomNavigation from "./bottomNavigation";
export * as breadcrumb from "./breadcrumb";
export * as button from "./button";
export * as buttonGroup from "./buttonGroup";
Expand Down
44 changes: 44 additions & 0 deletions apps/web/public/images/components/bottom-bar-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading