MUI Autocomplete options Array Problem


i had this code:

val cars = arrayOf("Volvo", "BMW", "Ford", "Mazda")

and Autocomplete from MUI

Autocomplete {

The Props options=cars i get an error like "

I dont understand, why because there is an array and options need an array.


I’m not familiar with MUI, but it looks like it expects a type parameter somewhere that you’re not providing maybe? A quick and dirty fix would be

Autocomplete {
  options = cars as dynamic

Hy kyay10,

thanks, but i dont know where the problem is. Here is the full code example:

val cars = arrayOf<dynamic>("The Godfather", "Pulp Fiction")
    Autocomplete {
        disablePortal = true
        id = "combo-box-demo"
        options = cars
        sx {
            width = 300.px
        renderInput = { params ->
            TextField.create {
                fullWidth = true
                variant = FormControlVariant.standard
                label = ReactNode("Cars")
                this.inputProps = params.inputProps.unsafeCast<InputBaseComponentProps>()