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

AutoComplete Input Passthrough not passing through #6575

Closed
Josje92 opened this issue May 6, 2024 · 4 comments
Closed

AutoComplete Input Passthrough not passing through #6575

Josje92 opened this issue May 6, 2024 · 4 comments
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team

Comments

@Josje92
Copy link

Josje92 commented May 6, 2024

Describe the bug

<AutoComplete
    pt={{
        input: {
            className: 'test',
            style: {
                 background: 'red',
            },
        },
    }}
    {...props}
/>

The input props won't get passed through for AutoComplete.
I've edited the basic preview from the docs in StackBlitz, also no dice.

Reproducer

https://stackblitz.com/edit/xyerqm?file=src%2FApp.jsx

PrimeReact version

10.6.5

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@Josje92 Josje92 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 6, 2024
@melloware
Copy link
Member

Can you try this: #6555 (comment)

@melloware
Copy link
Member

I fixed your example: https://stackblitz.com/edit/xyerqm-ihygrs?file=src%2FApp.jsx

@melloware melloware added Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 6, 2024
@Josje92
Copy link
Author

Josje92 commented May 6, 2024

Thanks!
It works, however ts-typings don't agree. Had to cast it to any when extending it in my custom component.

<AutoComplete
    pt={{
        ...pt,
        input: {
            ...pt?.input,
            root: {
                ...(pt?.input as any)?.root,
                className: ['w-full', (pt?.input as any)?.root?.className].filter(Boolean).join(' '),
            },
        },
    }}
    {...props}
/>

This needs to be done for pt.input, not even pt.input.root, so something still feels off. But I'm happy with this approach for now 😄

@melloware
Copy link
Member

ok yeah the Typescript defs probably need to be looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Workaround Issue or pull request contains a workaround. It needs to be reviewed further by Core Team
Projects
None yet
Development

No branches or pull requests

2 participants