-
First of: Congratulation on your amazing work! The styles are neat, the documentation nicely written, the generated DOM is slick, in general I really enjoy the project and I can totally imagine dropping my Material-UI usage for Mantine (and contribute)! There's just one thing that I have a little pain to get my head around... I love to work with Storybook and usually I create my components (based on Material-UI) the following way: import * as React from 'react';
import {
Button as MuiButton,
ButtonProps as MuiButtonProps,
} from '@material-ui/core';
export type ButtonProps = MuiButtonProps & { sound?: string; };
const Button = (props: ButtonProps) => {
const { sound, ...rest } = props;
// do some magic here
return <Button {...rest} />
};
export default Button; So that I can import the component and (most importantly in that case) its props type declaration to use in my (Storybook) stories the following way: import * as React from 'react';
import { Story, Meta } from '@storybook/react';
import Button, { ButtonProps } from './Button';
export default {
title: "Project/Components/Button",
component: Button,
} as Meta;
const Template: Story<ButtonProps> = (args) => (<Button {...args} />);
export const Base = Template.bind({}); Here's (finally) my question: The convenient thing about Material-UI is that they export the type of each component (suffixed with If not... would you accept a PR that provides that kind of feature (I may try but no strings attached... ;) )? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, thanks for feedback! Meanwhile, the easy solution to your problem is to use import { Button } from '@mantine/core';
type ButtonProps = React.ComponentProps<typeof Button>; |
Beta Was this translation helpful? Give feedback.
Hi, thanks for feedback!
Sure, I was thinking about exporting props but did not have time, if you'll create a PR that will be great.
Meanwhile, the easy solution to your problem is to use
React.ComponentProps
type: