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
Pass props to rebass Button component with typescript is not working #1008
Comments
Right now, I can only import separate props from styled-system one by one to make it work.import { FC } from 'react'
import { Button, ButtonProps } from 'rebass'
import { ColorProps, SpaceProps, LayoutProps } from 'styled-system'
const Btn: FC<ColorProps & SpaceProps & LayoutProps> = ({...props}) => {
return(
<Button {...props}></Button>
)
}
export default Btn |
I think you are missing the The following works well for myself. import React, { FC } from 'react';
import { Button as RebassButton, ButtonProps } from 'rebass';
const Button: FC<ButtonProps> = (props) => {
const { children, ...rest } = props;
return <RebassButton {...rest}>{children}</RebassButton>;
};
export default Button; (Edit: I have removed |
Recently I faced the same problem as well. A solution would be to destructure css property { children, css, ...props } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the higher component I built based on rebass Button
Can't pass props to Button if I give ButtonProps to Btn, is there any way to do that?
The text was updated successfully, but these errors were encountered: