UNPKG

@carbon/react

Version:

React components for the Carbon Design System

46 lines (42 loc) 1.31 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 PropTypes from 'prop-types'; import React from 'react'; import { usePrefix } from '../../internal/usePrefix.js'; const SideNavDetails = ({ children, className: customClassName, title, ...rest }) => { const prefix = usePrefix(); const className = cx(`${prefix}--side-nav__details`, customClassName); return /*#__PURE__*/React.createElement("div", _extends({ className: className }, rest), /*#__PURE__*/React.createElement("h2", { className: `${prefix}--side-nav__title`, title: title }, title), children); }; SideNavDetails.propTypes = { /** * Provide optional children to render in `SideNavDetails`. Useful for * rendering the `SideNavSwitcher` component. */ children: PropTypes.node, /** * Optionally provide a custom class to apply to the underlying `<li>` node */ className: PropTypes.string, /** * Provide the text that will be rendered as the title in the component */ title: PropTypes.string.isRequired }; export { SideNavDetails as default };