You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The types for component colors do not allow for customisation.
Added customColor to tailwind.config.ts
Added customColor to valid array in MT Theme
Added customColor to styles array in MT Theme
The component does accept the prop and render correctly, but these warnings appear constantly in the console.
I know these are warnings and not errors, but the console noise is incredibly annoying for every component to be clogging my logs with warnings telling me that a color that DOES exist, doesn't exist.
(This is the same for other components too)
The prop type of color should allow for all custom values defined in valid and not log any errors.
"use client";
import { Typography as MtTypography } from "@material-tailwind/react";
import { PropsWithChildren } from "react";
const Typography = ({ children }: PropsWithChildren) => {
return (
<MtTypography
color="customColor"
>
{children}
</MtTypography>
);
};
export default Typography;
The text was updated successfully, but these errors were encountered:
samhepburn-98
changed the title
Cannot use custom colors in Typescript projects
Custom colors in Typescript projects cause constant log errors
Jan 11, 2024
@samhepburn-98 the issue is with PropTypes and we can't pass custom value to it this issue will be fixed on v3 since we've dropped the PropTypes library and only rely on the typescript types.
The types for component colors do not allow for customisation.
valid
array in MT Themestyles
array in MT ThemeThe component does accept the prop and render correctly, but these warnings appear constantly in the console.
I know these are warnings and not errors, but the console noise is incredibly annoying for every component to be clogging my logs with warnings telling me that a color that DOES exist, doesn't exist.
(This is the same for other components too)
The prop type of
color
should allow for all custom values defined invalid
and not log any errors.I am using Next.js 14, with Tailwind 3.4.1
My
tailwind.config.ts
My Theme Provider:
My Typography component
The text was updated successfully, but these errors were encountered: