UNPKG

@carbon/react

Version:

React components for the Carbon Design System

67 lines (61 loc) 1.9 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. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js'); var PropTypes = require('prop-types'); var React = require('react'); var cx = require('classnames'); var usePrefix = require('../../internal/usePrefix.js'); const Breadcrumb = /*#__PURE__*/React.forwardRef((props, ref) => { const { 'aria-label': ariaLabel, children, className: customClassNameNav, noTrailingSlash, size, ...rest } = props; const prefix = usePrefix.usePrefix(); const className = cx({ [`${prefix}--breadcrumb`]: true, [`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash, [`${prefix}--breadcrumb--sm`]: size === 'sm' }); return /*#__PURE__*/React.createElement("nav", _rollupPluginBabelHelpers.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: `sm` & `md` (default: 'md') */ size: PropTypes.oneOf(['sm', 'md']) }; exports.default = Breadcrumb;