Skip to content
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

Custom Component typings #212

Closed
ReptoxX opened this issue Jul 18, 2023 · 2 comments
Closed

Custom Component typings #212

ReptoxX opened this issue Jul 18, 2023 · 2 comments

Comments

@ReptoxX
Copy link
Contributor

ReptoxX commented Jul 18, 2023

Hello,

i'm not sure if this is already mentioned (searched through the issues):
I use a custom Button component with additional props (like: size, variant, block).
When using the <Button> i can pass them in, it works but gives me an ugly typescript error.

{({ Field, Button, Errors, register }) => (
  <FormContainer size="md">
    <Errors className="mb-8" />
    <Field name="userName" />
    <Field name="password">
    {({ Label, Errors }) => (
      <>
        <Label />
        <PasswordInput {...register('password')} />
        <Errors />
      </>
    )}
    </Field>
    <Field name="rememberMe" />
    <Button block />
    //      ^ -- throws: Property 'block' does not exist on type 'IntrinsicAttributes & ClassAttributes<HTMLButtonElement> & ButtonHTMLAttributes<HTMLButtonElement>'
    <div className="mt-4 text-center">
      <span>Don't have an account yet? </span>
    </div>
  </FormContainer>
)}

Is there a way of changing the type of the button throughout the project?

Best Regards

@danielweinmann
Copy link
Contributor

Hey, @ReptoxX! We're figuring out how to do this, but it will likely be a v2 API if we find a good solution. We're keeping track of the discussion on #121 (which I couldn't help but notice it's a mirror of #212 😅 ).

We appreciate any contributions! Thank you.

@ReptoxX
Copy link
Contributor Author

ReptoxX commented Jul 20, 2023

Thanks for the friendly answer, i must've missed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants