-
-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom variants #694
Comments
@YuriyDyachkov were you able to find the solutions to this? I am trying add a custom variant in button component. Could you please guide me on how we can do it? |
@Munaf-Divan I can't. We have stopped using this library. |
Hi I was able to fix the type error by doing something similar to this (#191 (comment)).
'use client'
import { Button, ButtonProps } from '@material-tailwind/react'
interface Props extends Omit<ButtonProps, "variant"> {
variant?:
| "filled"
| "outlined"
| "gradient"
| "text"
| "custom-variant";
}
export default function CustomButton(props: Props) {
/* eslint-disable @typescript-eslint/no-explicit-any */
return <Button {...(props as any)} />;
}
Since variant type is hard coded in the library, I think you need to create your own wrapper to override the variant type. material-tailwind/packages/material-tailwind-react/src/types/components/button.ts Line 13 in 1558739
|
I'm trying to add my own props option for a typography component. it works from a code point of view, but the typescript throws an error. Tell me how can I fix this?
The text was updated successfully, but these errors were encountered: