@jan-leila/react-bread-crumb

1.0.1 • Public • Published

react-bread-crumb

NPM JavaScript Style Guide

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 reloads
useRootCrumb(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 useRootCrumb
useCrumb(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

Readme

Keywords

none

Package Sidebar

Install

npm i @jan-leila/react-bread-crumb

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

26.7 kB

Total Files

7

Last publish

Collaborators

  • jan-leila