Congrats! You just saved yourself hours of work by using react-animated-navbars library for creating animated navigation panels
install it using npm or yarn to include it in your own React project
You will also need to import css modules in root your project before using it. dist/react-animated-navbars.cjs.development.css
npm i react-hamburger-menus
yarn add react-hamburger-menus
- Import
GhostNavbar
component fromreact-animated-navbars
- Import styles
react-animated-navbars/dist/style.css
import React from "react";
import { GhostNavbar } from "react-hamburger-menus";
import "react-hamburger-menus/dist/style.css";
const App = () => {
return (
<>
<GhostNavbar
styles={{
floatButtonSize: 0.9,
floatButtonX: 6,
floatButtonY: 4
}}
>
<ul>
<li>ABOUT</li>
<li>PROJECTS</li>
<li>ELEMENTS</li>
<li>CONTACT</li>
</ul>
</GhostNavbar>
</>
);
};
export default App;
import Link from 'next/link'
.
.
<ul>
<li>
<Link href="/"> Home </Link>
</li>
.
.
Direct props use ul
tag with li
or else animations wont be applied
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode (ul > li) |
optional | Navbar items |
className | string | optional | Base class |
styles | styles object | optional | Base styles |
If you want custom styles pass your CSS styling(Javascript Object
) in Styles props using specific key mentioned below to apply styling correctly.
Take a look at the live demo for custom styling!
Property | Type | Default | Description |
---|---|---|---|
navigation | React CSS Properties | optional | Base styling |
navigationButton | React CSS Properties | optional | Ghost button styling |
navigationIcon | React CSS Properties | optional | Ghost icon styling |
navigationBackground | React CSS Properties | optional | Panel background styling |
iconHeight, iconWidth, iconColor | string | optional | Icon style |
floatButtonX | number | 85 |
Ghost button X position from right |
floatButtonY | number | 2 |
Ghost button Y position from top |
listHoverColor | [string, string] | [color 1, color 2] |
Hover animation color |
fontColor, Size, HoverColor | optional | string | common text styling |
zIndex | number | optional | z-Index (1000) |
Small screen
Large screen
import React from "react";
import { ResponsiveNavbar } from "react-hamburger-menus";
import "react-hamburger-menus/dist/style.css";
export const Default = () => (
<ResponsiveNavbar
logo={<p>Logo</p>}
styles={{
navigation: { fontFamily: 'Arial, Helvetica, sans-serif' },
navigationBarSmall: {
backgroundColor: 'aliceblue',
},
navigationCardSmall: {
backgroundColor: 'aliceblue',
},
}}
>
<ul>
<li>ABOUT</li>
<li>PROJECTS</li>
<li>ELEMENTS</li>
<li>CONTACT</li>
</ul>
</ResponsiveNavbar>
);
Direct props use ul
tag with li
or else animations wont be applied
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode (ul > li) |
optional | Navbar items |
className | string | optional | Base class |
styles | styles object | optional | Base styles |
logo | ReactNode | optional | Navbar logo |
If you want custom styles pass your CSS styling(Javascript Object
) in Styles props using specific key mentioned below to apply styling correctly.
Take a look at the live demo for custom styling!
Property | Type | Default | Description |
---|---|---|---|
navigation | React CSS Properties | optional | Base styling |
navigationBarSmall | React CSS Properties | optional | Navbar small screen styling |
navigationButtonSmall | React CSS Properties | optional | Navbar button small screen styling (toggle) |
navigationCardSmall | React CSS Properties | optional | Navbar card small screen styling (toggle) |
navigationBarLarge | React CSS Properties | optional | Navbar card large screen styling (toggle) |
iconColor, iconWidth, iconHeight | string | optional | Icon styling (toggle) |
zIndex | number | optional | z-Index (1000) |
animationDelay | number | string | optional |
import React from "react";
import { GhostButton } from "react-hamburger-menus";
import "react-hamburger-menus/dist/style.css";
const App = () => {
return (
<>
<GhostButton
styles={{
floatButtonX: 85,
floatButtonY: 7
}}
>
<ul>
<li>ABOUT</li>
<li>PROJECTS</li>
<li>ELEMENTS</li>
<li>CONTACT</li>
</ul>
</GhostButton>
</>
);
};
export default App;
.
<GhostButton
icon={
<p style={{ fontSize: '19px', borderBottom: '1px solid grey' }}>Users</p>
}
/>
.
.
Prop | Type | Default | Description |
---|---|---|---|
children | ReactNode (ul > li) |
optional | Navbar items |
className | string | optional | Base class |
styles | styles object | optional | Base styles |
icon | ReactNode | optional | custom icon |
Take a look at the live demo for custom styling!
Property | Type | Default | Description |
---|---|---|---|
navigation | React CSS Properties | optional | Base styling |
navigationButton | React CSS Properties | optional | Ghost button styling |
navigationIcon | React CSS Properties | optional | Ghost icon styling |
navigationCard | React CSS Properties | optional | Panel pop-up card styling |
floatButtonSize | number | optional | Ghost button size (just number) |
floatButtonX | number | 85 |
Ghost button X position from right |
floatButtonY | number | 2 |
Ghost button Y position from top |
fontColor, Size | optional | string | common text styling |
iconHeight, iconWidth, iconColor | string | optional | Icon style |
listHoverColor | string | aqua |
Hover animation color |
leftReveal, rightReveal, backgroundBox, backgroundCircle | string | leftReveal backgroundCircle |
annimation |
zIndex | number | optional | z-Index (1000) |
The Library is in developing stage
- Feel free to Open an issue on GitHub to request any additional features you might need for your use case.
- Connect with me on LinkedIn. I'd love β€οΈοΈ to hear where you are using this library.
Because this project uses CSS3 features, it's only meant for modern browsers. Some browsers currently fail to apply some of the animations correctly.
It is well tested for chrome, safari and firefox.
This software is open source, licensed under the MIT License.