@carbon/react
Version:
React components for the Carbon Design System
49 lines (47 loc) • 1.49 kB
JavaScript
/**
* Copyright IBM Corp. 2016, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { usePrefix } from "../../internal/usePrefix.js";
import classNames from "classnames";
import { forwardRef } from "react";
import PropTypes from "prop-types";
import { jsx } from "react/jsx-runtime";
//#region src/components/Breadcrumb/Breadcrumb.tsx
/**
* Copyright IBM Corp. 2016, 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const Breadcrumb = forwardRef((props, ref) => {
const { "aria-label": ariaLabel, children, className: customClassNameNav, noTrailingSlash, size, ...rest } = props;
const prefix = usePrefix();
const className = classNames({
[`${prefix}--breadcrumb`]: true,
[`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash,
[`${prefix}--breadcrumb--sm`]: size === "sm"
});
return /* @__PURE__ */ jsx("nav", {
className: customClassNameNav,
"aria-label": ariaLabel ? ariaLabel : "Breadcrumb",
ref,
...rest,
children: /* @__PURE__ */ jsx("ol", {
className,
children
})
});
});
Breadcrumb.displayName = "Breadcrumb";
Breadcrumb.propTypes = {
"aria-label": PropTypes.string,
children: PropTypes.node,
className: PropTypes.string,
noTrailingSlash: PropTypes.bool,
size: PropTypes.oneOf(["sm", "md"])
};
//#endregion
export { Breadcrumb as default };