# All files / src/main-layout-current MainLayoutTitle.tsx

0% Statements 0/33
0% Branches 0/1
0% Functions 0/1
0% Lines 0/33

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34

     import { cnb } from "cnbuilder";
    import type { ReactNode } from "react";
    import { forwardRef } from "react";
    import type { AppBarTitleProps } from "../app-bar";
    import { AppBarTitle } from "../app-bar";
    import type { CustomTypographyComponent } from "../typography";
    import { bem } from "../utils";

    const styles = bem("rmd-layout-title");

    export interface MainLayoutTitleProps extends AppBarTitleProps {
      /** @defaultValue `"h1"` */
      as?: CustomTypographyComponent;
      children: ReactNode;
    }

    export const MainLayoutTitle = forwardRef<
      HTMLHeadingElement,
      MainLayoutTitleProps
    >(function MainLayoutTitle(props, ref) {
      const { as = "h1", className, children, ...remaining } = props;

      return (
        <AppBarTitle
          {...remaining}
          as={as}
          ref={ref}
          className={cnb(styles({ offset: false }), className)}
        >
          {children}
        </AppBarTitle>
      );
    });