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] Add slotProps for Input #44117

Closed
svidskiy opened this issue Oct 16, 2024 · 1 comment
Closed

[Autocomplete] Add slotProps for Input #44117

svidskiy opened this issue Oct 16, 2024 · 1 comment
Assignees
Labels
component: autocomplete This is the name of the generic UI component, not the React module! customization: slot Component's slot customizability duplicate This issue or pull request already exists package: material-ui Specific to @mui/material

Comments

@svidskiy
Copy link

svidskiy commented Oct 16, 2024

Summary

Add a new way to throw parameters into the input via slotProps

Examples

My variant via custom prop:

type AutocompleteProps<
    Value = unknown,
    Multiple extends boolean | undefined = false,
    DisableClearable extends boolean | undefined = false,
    FreeSolo extends boolean | undefined = false
> = Omit<MUIAutocompleteProps<Value, Multiple, DisableClearable, FreeSolo>, 'renderInput'> & {
    inputProps?: Omit<ComponentProps<typeof TextField>, 'value' | 'onChange'>;
};

export const Autocomplete = forwardRef<HTMLInputElement, AutocompleteProps>(
    ({ inputProps, ...props }, ref) => {
        return (
            <MUIAutocomplete
                ref={ref}
                renderInput={params => (
                    <TextField {...params} {...inputProps} />
                )}
                {...props}
            />
        );
    }
);

What implementation would like to see:

  <Autocomplete
        options={['one', 'two', 'three']}
        slotProps={{
            input: {
                placeholder: 'Type to search'
            }
        }}
    />

Motivation

No response

Search keywords: autocomplete, slotprops, slots

@svidskiy svidskiy added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 16, 2024
@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Oct 16, 2024
@siriwatknp siriwatknp added package: material-ui Specific to @mui/material customization: slot Component's slot customizability and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 17, 2024
@mj12albert
Copy link
Member

Duplicate of #44145

@mj12albert mj12albert marked this as a duplicate of #44145 Oct 23, 2024
@github-actions github-actions bot added the duplicate This issue or pull request already exists label Oct 23, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! customization: slot Component's slot customizability duplicate This issue or pull request already exists package: material-ui Specific to @mui/material
Projects
None yet
Development

No branches or pull requests

4 participants