@jan-leila/react-bread-crumb
v1.0.1
Published
library for managing bread crumbs in react
Downloads
2
Readme
react-bread-crumb
Install
npm install --save @jan-leila/react-bread-crumb
Basic Usage
import React, { Component } from 'react'
import { Breadcrumb, useTrailView, useCrumb } from '@jan-leila/react-bread-crumb'
const App = () => {
return (
return <Breadcrumb>
{/* your app goes here*/}
</Breadcrumb>
)
}
const Header = () => {
const trail = useTrail()
/* render trail here */
}
const Page = () => {
useCrumb()
}
Advanced usage
useRawTrail()
- the raw trail can get exported if you would like to use it to re initialize it when Breadcrumb reloads<Breadcrumb trail={...} />
- trail can be provided to Breadcrumb to initialize the crumb on reloadsuseRootCrumb(crumb)
- useRootCrumb can be used to set a root element that will reset the trail<RootCrumb crumb={...} />
- RootCrumb can be used in the same way as useRootCrumbuseCrumb(crumb, id)
- useCrumb can be provided and id that will be used to truncate the trail when a match is found earlier in the trail<Crumb crumb={...} id={...} />
- Crumb can be used in the same way as useCrumb
License
MIT © jan-leila