Skip to content

[Autocomplete] Add ability to change the root element via slots #47755

@GerardasB

Description

@GerardasB

Summary

Autocomplete component should support changing of the root element by exposing the component prop or by exposing the root property in the slotProps prop, similarly to chip

Examples

https://stackblitz.com/edit/vitejs-vite-nwrkid3s?file=src%2FApp.tsx%3AL14

Motivation

This is useful when customizing the semantics of Autocomplete from within a theme (without having to deliver wrapper components). I.e. having a context that wraps the input is useful when adding group semantics with associated label (context can be used to determine if the TextField is rendered within Autocomplete w/o needing to lookup DOM structure/class names).

Search keywords: autocomplete, root element, component prop

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: autocompleteChanges related to the autocomplete. This includes ComboBox.type: new featureExpand the scope of the product to solve a new problem.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions