i want to use a material ui textfield with InputAd...
# javascript
t
i want to use a material ui textfield with InputAdorments. in the mui docs it is decalred like so
Copy code
InputProps={{
            startAdornment: <InputAdornment position="start">kg</InputAdornment>,
          }}
How do i do that in kotlinjs? i cant find any implementation of
InputBaseComponentProps
t
i cant find any implementation of
InputBaseComponentProps
“implementation”?
t
well its an interface 😄
but your reaction tells me: im not looking for an implementation of this interface. so how would i add the adorments then?
t
Copy code
InputProps = jso {
    startAdornment = InputAdornment.create { 
        position = "start"
    }
}
t
@turansky Ah ok this is the way. thank you. Yet another working but unintuitive way 😉 But... i think there is a bug. i now realize, that the type of the
TestFields
prop
inputProps
has the wrong type.
InputBaseComponentProps
doesnt even have the properties
startAdornment
or
endAdornment
although it should have according to the MUI docs. Yet in the same file another Type
InputBaseProps
which has those properties. Ist this a bug or am i - agian - too stupid to see what is the correct way? Also: i created a new
external interface
extending
InputBaseComponentProps
which in turn declares both fields the same way
InputBaseProps
does. But this results in an
<input>
html tag rendered like this:
startadornment="[object Object]"
t
Yet another working but unintuitive way 😉
2 component factories 1 element factory (used in example)
t
@turansky and what do you think about the other stuff i wrote?
t
Looks like you need another
InputComponent
, which has
startAdornment
property (not
input
)
t
I took everything from the MUI docs...
t
Link please 🙂
t
@turansky https://mui.com/material-ui/react-text-field/#input-adornments please have a look at the code of the first example 🙂
t
It looks like connected items in forms
t
I dont know what you mean... the code from above i got from the example:
Copy code
<TextField
          label="With normal TextField"
          id="outlined-start-adornment"
          sx={{ m: 1, width: '25ch' }}
          InputProps={{
            startAdornment: <InputAdornment position="start">kg</InputAdornment>,
          }}
        />
I dont think this is currently doable with the mui-wrapper
t
сс @aerialist
a
Hi @thana, here you can find the working example - TextFields. Input Adornments and the demo stand. @turansky, yep there is a problem with inheritance in our declarations.
t
@aerialist oh very cool! i was unsure whether or not to file a feature request against kotlin-mui-showcase. very cool. thank you very much :)
a
You are welcome! And PRs are welcome too 😉
❤️ 1