UNPKG

980 BJavaScriptView Raw
1import classNames from 'classnames';
2import * as React from 'react';
3import { useMemo } from 'react';
4import { useBootstrapPrefix } from './ThemeProvider';
5import CardHeaderContext from './CardHeaderContext';
6import { jsx as _jsx } from "react/jsx-runtime";
7const CardHeader = /*#__PURE__*/React.forwardRef(({
8 bsPrefix,
9 className,
10 // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
11 as: Component = 'div',
12 ...props
13}, ref) => {
14 const prefix = useBootstrapPrefix(bsPrefix, 'card-header');
15 const contextValue = useMemo(() => ({
16 cardHeaderBsPrefix: prefix
17 }), [prefix]);
18 return /*#__PURE__*/_jsx(CardHeaderContext.Provider, {
19 value: contextValue,
20 children: /*#__PURE__*/_jsx(Component, {
21 ref: ref,
22 ...props,
23 className: classNames(className, prefix)
24 })
25 });
26});
27CardHeader.displayName = 'CardHeader';
28export default CardHeader;
\No newline at end of file