import { ArgsTable } from '@storybook/addon-docs/blocks';
import { Breadcrumbs } from "../Breadcrumbs";

# Breadcrumbs

Use Breadcrumbs for displaying page location details.

## Props

Breadcrumbs have 2 properties:

  - `breadcrumbNameMap` is an object which keys found in the current page path are replaced with the object values
  - `pathDepth` is the maximum amount of path units which are displayed in the Breadcrumbs

<ArgsTable of={Breadcrumbs} />

## Context

Breadcrumbs have actions that are displayed as a range of JSX action buttons which can be set, updated and deleted.
In order to update Breadcrumbs use `useBreadcrumbsActions` hook which returns `actions` and `updateActions`.
Use an object for `actions` value from the hook, so that you could update or delete the needed action selecting it by the key.
Therefore, using `updateActions` function pass an object for adding a new action.
For example:

`updateActions({ client: <ClientUI /> })`

If you want to add more actions after the first call of `updateActions`, append them to the previous actions.
For example:

`updateActions((prevActions) => ({ ...prevActions, { newKey: <NewValue /> } }))`

If you need to delete a separate action, apply this approach:

`updateActions(prevActions => {
  const actions = { ...prevActions };
  if (actions) {
    delete actions.keyToBeDeleted;
  }
  return actions;
})`
