Skip to main content
Refine AI
Version: 4.xx.xx
Swizzle Ready

Breadcrumb

A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy. <Breadcrumb> component was built with the Chakra UI Breadcrumb components using the useBreadcrumb hook.

Good to know:
  • You can swizzle this component with the Refine CLI to customize it.

  • In the earlier versions of Refine, <Refine> component had accepted DashboardPage which could be used to add an index page to your app. With the changes in routerProvider API of Refine, DashboardPage is deprecated. You can now define an index route yourself manually with your router package.

  • In earlier versions, the home icon in the Breadcrumb was created by the DashboardPage, now it is rendered if you define a an action route as / in any one of your resources. It will be rendered with the home icon regardless of the current route. You can also hide the home icon by setting showHome to false.

Properties

<Breadcrumb> component uses the Chakra UI Breadcrumb component so it can be configured with the breadcrumbProps property.

import { List, Breadcrumb } from "@refinedev/chakra-ui";

export const PostList: React.FC = () => {
return (
<List
breadcrumb={<Breadcrumb breadcrumbProps={{ separator: "-" }} />}
>
...
</List>
);
};

showHome

If you have a page with route /, it will be used as the root of the hierarchy and shown in the Breadcrumb with a home icon. To hide the root item, set showHome to false.

import { List, Breadcrumb } from "@refinedev/chakra-ui";

export const PostList: React.FC = () => {
return (
<List
breadcrumb={<Breadcrumb showHome={true} />}
>
...
</List>
);
};

meta

If your routes has additional parameters in their paths, you can pass the meta property to the <Breadcrumb> component to use them while creating the paths and filling the parameters in the paths. By default, existing URL parameters are used. You can use meta to override them or add new ones.

import { List, Breadcrumb } from "@refinedev/chakra-ui";

export const PostList: React.FC = () => {
return (
<List
breadcrumb={<Breadcrumb meta={{ authorId: "123" }} />}
>
...
</List>
);
};

hideIcons

If you don't want to show the resource icons on the breadcrumb, you can set hideIcons to true.

import { List, Breadcrumb } from "@refinedev/chakra-ui";

export const PostList: React.FC = () => {
return (
<List
breadcrumb={<Breadcrumb hideIcons />}
>
...
</List>
);
};

API Reference

Properties

PropertyTypeDescriptionDefault
breadcrumbProps

BreadcrumbProps

Passes properties for <Breadcrumb>

showHome

boolean

Shows the home button if you have a resource with list action defined as / route.

true

hideIcons

boolean

Allows to hide resource icons

false

meta

Record<string, string

number>

Additional params to be used in the route generation process.

minItems

number

Minimum number of breadcrumb items required for rendering. The component will render only if the number of items is greater than or equal to this value.

2