No way to get ref to root of <Input> in a <TextField>
See original GitHub issue- This is a v1.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behaviour
<Input>
outputs a <div>
root that wraps the accents and the input. It should be possible to attach a ref to this input. And it should be possible to do this from a <TextField />
.
Current Behaviour
Input only passes {...other}
to the <div>
Context
I needed to attach a Popper based menu to the bottom of a TextField, but I need it to open lined up with the whole <Input>
, not the <input>
(then it’s inset by the inputAdornment) and not the <FormControl>
(then when the menu is above the input it will appear above the label instead of overlapping the label).
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
No way to get ref to root of <Input> in a <TextField> #12471
This is a v1.x issue. I have searched the issues of this repository and believe that this is not a duplicate. Expected Behaviour...
Read more >Unable to retrieve the input field of material UI using refs in ...
Now, I am trying to retrieve the input field value (TextField) using refs of React. It is always saying undefined. This is my...
Read more >TextInput - Mantine
Capture string input from user. ... Get input ref. import { useRef } from 'react'; ... <TextInput /> // -> not ok, input...
Read more >React Forms - W3Schools
Handling forms is about how you handle the data when it changes value or gets submitted. In HTML, form data is usually handled...
Read more >InputAdornment API - Material UI - MUI
Note: If you are using the TextField component or the FormControl component you do not have to set this manually. The ref is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dantman have you tried
<TextField InputProps={{ref: c => this.inputDiv = findDOMNode(c)}} />
? (not sure if it works)@dantman for advanced use cases, I encourage people to break the TextField abstraction. You can use the lower level components.