@codecraftkit
Documentation
NavBar component rendered at the top of the page.
it can be imported from the core.
import { NavBar } from "@codecraftkit/core";
or alone.
import NavBar from "@codecraftkit/navbar";
function MyApp() {const options = {menu: [{href: 'https://chakra-ui.com',label: 'Chakra-UI'},{href: 'https://es.reactjs.org/',label: 'ReactJs'},{href: 'https://nextjs.org/',label: 'Next.JS'}]}return <NavBar menu={options.menu} w='100%' />}
function MyApp() {const user = {name: 'username',lastName: 'lastname',img:'https://picsum.photos/200',token:'token',links:{profile: '#'}}const avatarMenu = [{divider:true}, {label:'Link Test',action:()=>alert('action')}, {group:'Link Group',items:[{label:'Link Group 1',action:()=>alert('action 1')}, {label:'Link Group 2',action:()=>alert('action 2')}]}]const logout = () => alert('The user has logout')const options = {menu: [{href: 'https://chakra-ui.com',label: 'Chakra-UI'},{href: 'https://es.reactjs.org/',label: 'ReactJs'},{href: 'https://nextjs.org/',label: 'Next.JS'}]}return <NavBarmenu={options.menu}session={user}logout={logout}profileLink={false}avatarMenu={avatarMenu}w='100%'/>}
function MyApp(){const options = {leftAction: {icon: <MdApps />,styles: { fontSize: '35px' },label: 'Access',component: <BoxContainer noBorder title='Access'>Left Action</BoxContainer>},menu: [{href: 'https://chakra-ui.com',label: 'Chakra-UI'},{href: 'https://es.reactjs.org/',label: 'ReactJs'},{href: 'https://nextjs.org/',label: 'Next.JS'}],rightActions: [{label: 'Our Team',icon: <FaUsers/>,component: <BoxContainer noBorder title='Our Team'><Box h="350px"><CustomScroll heightRelativeToParent="100%">Right Action with Scroll</CustomScroll></Box></BoxContainer>}]}return <NavBar// logo={options.logo}menu={options.menu}leftAction={options.leftAction || undefined}rightActions={options.rightActions}w='100%'/>}
const leftAndRightActionsExample = [{label: 'Example 1',href: 'https://chakra-ui.com',},{label: 'Example 2',href: 'https://chakra-ui.com',isExternal:true},{label: 'Example 3',action: () => alert('action')}, {label: 'Example 4',action: () => alert('action'),icon: <FaUsers/>,}, {label: 'Example Group',icon: <FaUsers/>,component: <BoxContainer noBorder title='Example Group'><Box h="350px"><CustomScroll heightRelativeToParent="100%">Right Action with Scroll</CustomScroll></Box></BoxContainer>}, {//label: 'Example Group',icon: <FaUsers/>,subItems: [{href: 'https://chakra-ui.com',label: 'Chakra-UI'},{href: 'https://es.reactjs.org/',label: 'ReactJs'},{href: 'https://nextjs.org/',label: 'Next.JS'},]}]const avatarItemsExample = [{label: 'Example 1',href: 'https://chakra-ui.com',},{label: 'Example 2',action: () => alert('action')},{group: 'Link Group',items: [{label: 'Link Group 1',action: () => alert('action 1')}, {label: 'Link Group 2',action: () => alert('action 2')}]},{divider: true},]
logo
Component
no
Component to use for the app logo
menu
array<objects>
no
Items shown in the right side of the logo
rightActions
array<objects>
no
Items shown in the left side of the avatar image
leftAction
array<objects>
no
Items shown in the left side of the logo
leftComponent
Component
no
Component shown in the right side of the logo, useful for inputs searches
rightComponent
Component
no
Component shown in the right side next to the right actions
avatarMenu
array<objects>
no
Adds items between the default ones
session
object
no
Current logged user
logout
function
no
handle logout function
profileLink
Boolean
no
true
Show or hide the profile link
languageSelect
Component
no
This prop is mean to be used with the hook useLanguageSelect to change the language context
profilesSelect
Boolean
no
Show or hide the profile select
getSession
Component
no, unless profilesSelect is true
Prop to fecth the user session
skipProfilePageReload
Boolean
no
Avoid reload the page on profile change
...rest
chakra style <props>
no
props to style the input itself, https://chakra-ui.com/docs/features/style-props