React-admin: Add breadcrumb

Created on 2 Oct 2018  路  5Comments  路  Source: marmelab/react-admin

A breadcrumb that would indicate the current path could improve usability, i.e. if I am in
/products/1/show
breadcrumb should be
Dashboard (home link) > Products (products link) > Product 1

enhancement

All 5 comments

This can be done in userland pretty easily:

export const FooList = ({ history, ...rest }) => {
    const breadcrumbPath = [
        { url: "/foos", title: "Foos", isActive: false }
    ];
    return (
        <React.Fragment>
            <Breadcrumb path={breadcrumbPath} />
            <List {...rest}>
                <Datagrid>
                       ...
                </Datagrid>
            </List>
        </React.Fragment>
    );
}

So closing as nothing must be changed in core to allow this.

@fzaninotto I have the same problem, I want to show the product name, like
Dashboard (home link) > Products (products link) > Product Name

where is this Breadcrumb component defined? Is it a custom react component?

It's a custom component, but you can easily write some MUI code directly with https://material-ui.com/components/breadcrumbs/#breadcrumbs

For the people scooting across this in the future, we use https://www.npmjs.com/package/react-router-breadcrumbs-hoc

It works quite well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dragomir-Ivanov picture Dragomir-Ivanov  路  3Comments

kikill95 picture kikill95  路  3Comments

fzaninotto picture fzaninotto  路  3Comments

samanmohamadi picture samanmohamadi  路  3Comments

mbj36 picture mbj36  路  3Comments