![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@asphalt-react/breadcrumb
Advanced tools
Breadcrumb gives users navigational awareness inside the app. It is collection of Crumbs & Separators. Breadcrumb uses /
as separator by default but it also enables customizing it. Crumbs work with both an anchor tag or any client side routers. Crumbs can also have a non link text as well.
Breadcrumb adds a scroll when the number of Crumbs exceeds the space available, Additionally you can collapse some Crumbs to have compact form. Breadcrumb is a controlled component.
import { Breadcrumb, Crumb, CrumbLink } from "@asphalt-react/breadcrumb"
<Breadcrumb
crumbs={[
<Crumb key="0">
<CrumbLink asProps={{ href: "/" }}>
Home
</CrumbLink>,
</Crumb>,
<Crumb key="1">
<CrumbLink asProps={{ href: "/blog" }}>
Blog
</CrumbLink>
</Crumb>,
<Crumb key="2">
<CrumbLink asProps={{ href: "/blog/boom" }}>
Boom
</CrumbLink>
</Crumb>
]}
/>
Breadcrumb component comes with:
BaseBreadcrumb
is a wrapper component which renders an ordered list containing its children
.
Use Crumb
to create a list item for Breadcrumb.
Use CrumbLink
to create link for Breadcrumb.
You can provide custom separator using Separator
.
Breadcrumbs can render in collapsed mode. Breadcrumb doesn't manage the collapsed state on its own it depends on collapsed
prop to change the state from expanded to collapsed and vice versa. In collapsed state you can choose to hide specific Crumbs using collapseIndices
prop and render a button instead. This button invokes onCollapse
callback to expand the hidden Crumbs. You can also pass any custom node using collapseAs
prop but in that case you need to handle the interaction on your own.
import { Breadcrumb, Crumb, CrumbLink } from "@asphalt-react/breadcrumb"
export default App() {
const [collapsed, setCollapsed] = React.useState(true)
return (
<Breadcrumb
collapsed={collapsed}
collapseIndices={[1]}
onCollapse={() => setCollapsed(false)}
crumbs={[
<Crumb key="0">
<CrumbLink as={Link} asProps={{ to: "/" }}>
Home
</CrumbLink>
</Crumb>,
<Crumb key="1">
<CrumbLink as={Link} asProps={{ to: "/blog" }}>
Blog
</CrumbLink>
</Crumb>,
<Crumb key="2">
<CrumbLink as={Link} asProps={{ to: "/blog/boom" }}>
Boom
</CrumbLink>
</Crumb>,
]}
/>
)
}
aria-labels
.aria-hidden
to hide it from assistive technology.List of crumbs.
type | required | default |
---|---|---|
arrayOf | true | N/A |
Makes Breadcrumb collapse.
type | required | default |
---|---|---|
bool | false | false |
React node for separator.
type | required | default |
---|---|---|
node | false | "/" |
React node render in the collapsed state of Breadcrumb
type | required | default |
---|---|---|
node | false | null |
crumbs indices to collapse, must be in range and consecutive numbers.
type | required | default |
---|---|---|
arrayOf | false | [] |
function to call when collapseAs is clicked.
type | required | default |
---|---|---|
func | false | null |
BaseBreadcrumb is base wrapper component which renders an ordered list containing its children
. It adds scroll on overflow to make its content visible.
React node to render as children
type | required | default |
---|---|---|
node | true | N/A |
Component to add a list item in Breadcrumb.
React node to render link content.
type | required | default |
---|---|---|
node | true | N/A |
Component to add link in Crumb
. CrumbLink
handles the link pseudo-classes and additionally you can remove the ":visited" pseudo-class using visited
prop.
React node to render as children.
type | required | default |
---|---|---|
node | true | N/A |
Html element/React component to replace the default element. Using this prop, you can use your router's link element, such as "react-router-dom"'s Link element.
type | required | default |
---|---|---|
elementType | false | "a" |
Pass the props such as "href", "id" for the custom link element passed in as
prop.
type | required | default |
---|---|---|
object | false | {} |
shows visited state for the link.
type | required | default |
---|---|---|
bool | false | true |
Component to add text in Crumb
list item.
React node to render as children.
type | required | default |
---|---|---|
node | true | N/A |
Component to add the separator symbol between crumbs.
React node to render as children.
type | required | default |
---|---|---|
node | true | N/A |
FAQs
Breadcrumb
The npm package @asphalt-react/breadcrumb receives a total of 100 weekly downloads. As such, @asphalt-react/breadcrumb popularity was classified as not popular.
We found that @asphalt-react/breadcrumb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.