@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
53 lines (49 loc) • 1.45 kB
JavaScript
/**
* MSKCC 2021, 2024
*/
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import cx from 'classnames';
import { usePrefix } from '../../internal/usePrefix.js';
import PropTypes from 'prop-types';
const Breadcrumb = /*#__PURE__*/forwardRef(function Breadcrumb(_ref, ref) {
let {
ariaLabel,
children,
className: customClassNameNav,
noTrailingSlash,
...rest
} = _ref;
const prefix = usePrefix();
const breadcrumbClassName = cx({
[`${prefix}--breadcrumb`]: true,
[`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash
});
return /*#__PURE__*/React__default.createElement("nav", _extends({
className: customClassNameNav,
"aria-label": ariaLabel ?? 'Breadcrumb',
ref: ref
}, rest), /*#__PURE__*/React__default.createElement("ol", {
className: breadcrumbClassName
}, children));
});
Breadcrumb.displayName = 'Breadcrumb';
Breadcrumb.propTypes = {
/**
* Specify the label for the breadcrumb container
*/
ariaLabel: PropTypes.string,
/**
* Pass in the BreadcrumbItem's for your Breadcrumb
*/
children: PropTypes.node,
/**
* Specify an optional className to be applied to the container node
*/
className: PropTypes.string,
/**
* Optional prop to omit the trailing slash for the breadcrumbs
*/
noTrailingSlash: PropTypes.bool
};
export { Breadcrumb as default };