@carbon/ibm-products
Version:
Carbon for IBM Products
50 lines (48 loc) • 1.74 kB
JavaScript
/**
* 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 { pkg } from "../../../settings.js";
import React, { forwardRef } from "react";
import PropTypes from "prop-types";
//#region src/components/Card/next/CardTitleMedia.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 blockClass = `${pkg.prefix}--card-next__title-media`;
const componentName = "CardTitleMedia";
/**
* CardTitleMedia provides a media slot positioned to the left of the card title.
* The media slot adapts to the heading area height (min 48px, max 64px) and stays
* top-aligned when the title wraps to multiple lines.
*/
let CardTitleMedia = forwardRef(({ className, children, ...rest }, ref) => {
const titleMediaClasses = (0, import_classnames.default)(blockClass, className);
return /* @__PURE__ */ React.createElement("div", {
...rest,
ref,
className: titleMediaClasses
}, children);
});
CardTitleMedia.propTypes = {
/**
* Content to be rendered in the title media slot (typically an icon or small image)
*/
children: PropTypes.node,
/**
* Optional class name for custom styling
*/
className: PropTypes.string
};
CardTitleMedia = pkg.checkComponentEnabled(CardTitleMedia, componentName);
CardTitleMedia.displayName = componentName;
//#endregion
export { CardTitleMedia };