UNPKG

@carbon/react

Version:

React components for the Carbon Design System

49 lines (45 loc) 1.44 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 cx from 'classnames'; import React from 'react'; import PropTypes from 'prop-types'; import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js'; import { usePrefix } from '../../internal/usePrefix.js'; function HeaderNavigation({ 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, children, className: customClassName, ...rest }) { const prefix = usePrefix(); const className = cx(`${prefix}--header__nav`, customClassName); return /*#__PURE__*/React.createElement("nav", _extends({}, rest, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: className }), /*#__PURE__*/React.createElement("ul", { className: `${prefix}--header__menu-bar` }, children)); } HeaderNavigation.propTypes = { /** * Required props for accessibility label on the underlying menu */ ...AriaLabelPropType, /** * Provide valid children of HeaderNavigation, for example `HeaderMenuItem` * or `HeaderMenu` */ children: PropTypes.node, /** * Optionally provide a custom class to apply to the underlying <nav> node */ className: PropTypes.string }; export { HeaderNavigation as default };