UNPKG

@carbon/ibm-products

Version:
59 lines (57 loc) 1.83 kB
/** * Copyright IBM Corp. 2020, 2026 * * 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 { __toESM } from "../../../_virtual/_rolldown/runtime.js"; import { require_classnames } from "../../../node_modules/classnames/index.js"; import { blockClass } from "../PageHeaderUtils.js"; import React from "react"; import PropTypes from "prop-types"; import { unstable_Text } from "@carbon/react"; //#region src/components/PageHeader/next/PageHeaderContentText.tsx /** * Copyright IBM Corp. 2026 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ var import_classnames = /* @__PURE__ */ __toESM(require_classnames()); const PageHeaderContentText = ({ className, children, subtitle, subtitleAs = "h2", ...other }) => { const classNames = (0, import_classnames.default)({ [`${blockClass}__content__body`]: true }, className); return /* @__PURE__ */ React.createElement("div", { className: classNames, ...other }, subtitle && /* @__PURE__ */ React.createElement(unstable_Text, { as: subtitleAs, className: `${blockClass}__content__subtitle` }, subtitle), children); }; PageHeaderContentText.displayName = "PageHeaderContentText"; PageHeaderContentText.propTypes = { /** * Provide child elements to be rendered inside PageHeaderContentText. */ children: PropTypes.node, /** * Specify an optional className to be added to your PageHeaderContentText */ className: PropTypes.string, /** * The PageHeaderContent's subtitle */ subtitle: PropTypes.string, /** * Specify the element used to render the subtitle. */ subtitleAs: PropTypes.oneOf([ "h2", "h3", "h4", "h5", "h6" ]) }; //#endregion export { PageHeaderContentText };