Shmew / Feliz.MaterialUI

Feliz-style Fable bindings for Material-UI
https://shmew.github.io/Feliz.MaterialUI/
MIT License
70 stars 19 forks source link

How can I add an adornment to a text field? #44

Closed halcwb closed 4 years ago

halcwb commented 4 years ago

I cannot figure out how to add an adornment to a textfield like:

                        Mui.textField [
                            textField.label "First Systolic Blood Pressure"
                            textField.InputProps [
                                inputAdornment.classes.positionEnd "kg"

                                prop.children [
                                        Mui.inputAdornment [ 
                                            inputAdornment.position.end'
                                            inputAdornment.variant.standard
                                        ]
                                ]

                            ]
                        ]

So I want a text field looking like:

"Label" "Input" kg

cmeeren commented 4 years ago

The usage is the same as MUI, which you can find this in the MUI docs:

<TextField
  label="With normal TextField"
  InputProps={{
    endAdornment: <InputAdornment position="end">Kg</InputAdornment>,
  }}
/>

This means in Feliz.MaterialUI it would look something like this:

Mui.textField [
  textField.label "Foo"
  textField.InputProps [
    input.endAdornment (
      Mui.inputAdornment [
        inputAdornment.position.end'
        inputAdornment.children "Kg"
      ]
    )
  ]
]

There are three errors in your code:

halcwb commented 4 years ago

Great, thanks. The mapping from your lib to Material UI, for me, is still a bit challenging. But I think I am getting the gist of it.

cmeeren commented 4 years ago

Everything is hard when you don't know it and easy once you have learned it. Let me know if there are things I can add/change in the Feliz.MaterialUI docs to make it better!

halcwb commented 4 years ago

Thanks again, it's a real joy to use your library. This is the app I am currently working on: https://github.com/halcwb/PediatricRiskCalculator.git

Any comments on your side are welcome!

cmeeren commented 4 years ago

Thanks for the kind words! Happy you're liking it. Unfortunately I don't have the capacity to do general code reviews, but let me know if you have problems or specific questions.