UNPKG

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