1.19.0 • Published 4 months ago

@asphalt-react/appbar v1.19.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
4 months ago

Appbar

Appbar component is the main navigation bar for the whole application. Use this component at the root of your application as the top navigation bar. It is contructed using 3 sections:

  1. Navigation: Contains all the links for navigation. Links can be added using NavItem component.
  2. Header: Application logo can be added using the logo prop.
  3. Footer: Avatar can be used here for user profile and ActionList to add some extra actions. They can be passed using footer prop.

The styles required for the Appbar to stick to the top of the screen needs to be added while implementation.

Responsive

Appbar is completely responsive. All the navigation links switch to a collapsible screen (navigation drawer) and a hamburger button is added to interact with the drawer.

Usage

<Appbar>
  <NavItem tagProps={{ href: "/" }}>Home</NavItem>
  <NavItem tagProps={{ href: "/profile" }}>Profile</NavItem>
</Appbar>

Props

children

NavItems for Appbar

typerequireddefault
nodefalseN/A

logo

React node for the logo.

<Appbar logo={<Logo />}
typerequireddefault
nodefalseN/A

footer

React node for the footer section. Avatar, Actionlist, etc can be added here

typerequireddefault
nodefalseN/A

NavItem

Using NavItem component, links can be added to the Appbar. By default, it renders an <a> tag but you can pass your custom element or React component using as prop. All the props related to the link should be passed in tagProps element.

⚠️ The NavItem component is different from the one in @asphalt-react/sidebar

Props

children

Caption for the link

typerequireddefault
stringtrueN/A

active

Adds styles for active link

typerequireddefault
boolfalseN/A

as

Element to be rendered for the link

typerequireddefault
elementTypefalse"a"

tagProps

props for the link element

typerequireddefault
objectfalse{ href: "#" }