Overflow mode in React Breadcrumb component
30 Jan 202324 minutes to read
In the Breadcrumb component, maxItems
and overflowMode
properties were used to limit the number of breadcrumb items to be displayed.
In the following example, the maxItems
is set as 3 with overflowMode as Default. To prevent breadcrumb item navigation, the enableNavigation
property has been set to false in the Breadcrumb component.
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate() {
return (<span className="e-bicons e-arrow"></span>);
}
return (<BreadcrumbComponent maxItems={3} enableNavigation={false} separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>);
}
export default App;
ReactDom.render(<App />, document.getElementById('element'));
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate(): JSX.Element {
return (
<span className="e-bicons e-arrow"></span>
);
}
return (
<BreadcrumbComponent maxItems={3} enableNavigation={false} separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('element'));
The following overflow modes are available in the Breadcrumb component.
- Collapsed
- Menu
- Wrap
- Scroll
- Hidden
- None
Collapsed
Collapsed mode shows the first and last Breadcrumb items and hides the remaining items with a collapsed icon. When the collapsed icon is clicked, all items become visible and navigable.
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate() {
return (<span className="e-bicons e-arrow"></span>);
}
return (<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Collapsed' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>);
}
export default App;
ReactDom.render(<App />, document.getElementById('element'));
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate(): JSX.Element {
return (
<span className="e-bicons e-arrow"></span>
);
}
return (
<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Collapsed' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('element'));
Menu
Menu mode shows the number of Breadcrumb items that can be accommodated within the container space and creates a submenu with the remaining items.
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate() {
return (<span className="e-bicons e-arrow"></span>);
}
return (<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Menu' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>);
}
export default App;
ReactDom.render(<App />, document.getElementById('element'));
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate(): JSX.Element {
return (
<span className="e-bicons e-arrow"></span>
);
}
return (
<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Menu' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('element'));
Wrap
Wrap mode wraps the items to multiple lines when the Breadcrumb’s width exceeds the container space.
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate() {
return (<span className="e-bicons e-arrow"></span>);
}
return (<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Wrap' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>);
}
export default App;
ReactDom.render(<App />, document.getElementById('element'));
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate(): JSX.Element {
return (
<span className="e-bicons e-arrow"></span>
);
}
return (
<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Wrap' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('element'));
Scroll
Scroll mode shows an HTML scroll bar when the Breadcrumb’s width exceeds the container space.
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate() {
return (<span className="e-bicons e-arrow"></span>);
}
return (<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Scroll' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>);
}
export default App;
ReactDom.render(<App />, document.getElementById('element'));
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate(): JSX.Element {
return (
<span className="e-bicons e-arrow"></span>
);
}
return (
<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Scroll' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('element'));
Hidden
Hidden mode shows the maximum number of items possible in the container space and hides the remaining items. Clicking on a previous item will make the hidden item visible.
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate() {
return (<span className="e-bicons e-arrow"></span>);
}
return (<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Hidden' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>);
}
export default App;
ReactDom.render(<App />, document.getElementById('element'));
import { BreadcrumbComponent, BreadcrumbItemDirective, BreadcrumbItemsDirective } from '@syncfusion/ej2-react-navigations';
import * as React from 'react';
import * as ReactDom from 'react-dom';
function App() {
function breadcrumbTemplate(): JSX.Element {
return (
<span className="e-bicons e-arrow"></span>
);
}
return (
<BreadcrumbComponent maxItems={3} enableNavigation={false} overflowMode='Hidden' separatorTemplate={breadcrumbTemplate}>
<BreadcrumbItemsDirective>
<BreadcrumbItemDirective text="Home" url="../"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Breadcrumb" url="./breadcrumb"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Default" url="./breadcrumb/default-functionalities"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Icons" url="./breadcrumb/icons"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Navigation" url="./breadcrumb/navigation"></BreadcrumbItemDirective>
<BreadcrumbItemDirective text="Overflow" url="./breadcrumb/overflow"></BreadcrumbItemDirective>
</BreadcrumbItemsDirective>
</BreadcrumbComponent>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('element'));
None
None mode shows all the items on a single line.