-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[joy-ui] How to access the ref of the <input>
?
#39187
Comments
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Input: <Input slotProps={{ input: { ref } }} /> Textarea: <Textarea slotProps={{ input: { ref } }} /> We can add a section in the docs that is specifically about input ref: diff --git a/docs/data/joy/components/textarea/textarea.md b/docs/data/joy/components/textarea/textarea.md
index 06a8652a80..2c80a6d3a6 100644
--- a/docs/data/joy/components/textarea/textarea.md
+++ b/docs/data/joy/components/textarea/textarea.md
@@ -115,6 +115,8 @@ It's usually more common to see textarea components using decorators at the top
{{"demo": "TextareaDecorators.js"}}
+### Textarea ref
+
## Accessibility
In order for the textarea to be accessible, **it should be linked to a label**.
|
Thank you! |
Would you like to submit a PR? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
I would like to contribute to this issue can you assign it to me ? also i am new to open source here i think i need to add demo to the docs how to use Ref right ? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
useRef
?<input>
?
If we take Material UI, even if we have slot props: https://mui.com/material-ui/api/input/#prop-inputProps I think it opens the question of:
@siriwatknp I wonder a bit about the frequency of the need to access the input ref. Is this frequent enough to be worth a dedicated docs? I guess if it was in Material UI for a dedicated prop, it's likely the case, but I wonder if: 1. maybe |
We have the doc about the inner HTML input but we could make it more obvious to |
Is this issue still open? |
It is a very common use case where we want to use ref with html inputs. That's why it should be given as a singleton root prop in the |
I was wondering how to use useRef with Joy UI Input or Textarea components.
I know that in Material UI it’s
inputRef
but I can’t make this work in Joy UI.I’m currently using onChange with useState, but I’d like to avoid re-rendering for each type. Thanks, Eytan
The text was updated successfully, but these errors were encountered: