UNPKG

@carbon/react

Version:

React components for the Carbon Design System

62 lines (58 loc) 1.76 kB
/** * Copyright IBM Corp. 2016, 2023 * * 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 { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js'; import PropTypes from 'prop-types'; import React, { forwardRef } from 'react'; import cx from 'classnames'; import { usePrefix } from '../../internal/usePrefix.js'; const Breadcrumb = /*#__PURE__*/forwardRef((props, ref) => { const { 'aria-label': ariaLabel, children, className: customClassNameNav, noTrailingSlash, size, ...rest } = props; const prefix = usePrefix(); const className = cx({ [`${prefix}--breadcrumb`]: true, [`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash, [`${prefix}--breadcrumb--sm`]: size === 'sm' }); return /*#__PURE__*/React.createElement("nav", _extends({ className: customClassNameNav, "aria-label": ariaLabel ? ariaLabel : 'Breadcrumb', ref: ref }, rest), /*#__PURE__*/React.createElement("ol", { className: className }, children)); }); Breadcrumb.displayName = 'Breadcrumb'; Breadcrumb.propTypes = { /** * Specify the label for the breadcrumb container */ 'aria-label': 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, /** * Specify the size of the Breadcrumb. Currently supports the following: */ size: PropTypes.oneOf(['sm', 'md']) }; export { Breadcrumb as default };