How do I extend the react aria props for auto-completion of attributes? #3631
Answered
by
reidbarber
PixeledCode
asked this question in
Q&A
-
So, everything is working fine, except that typescript is not doing any auto-completion for any of the attributes that, for example, This is how I am using the hook:
What changes do I need to make so that type is enabled for these props? |
Beta Was this translation helpful? Give feedback.
Answered by
reidbarber
Oct 12, 2022
Replies: 1 comment 2 replies
-
Update: You'll want to add a type to the props: import {AriaTextFieldProps} from '@react-types/textfield';
function TextField(props: AriaTextFieldProps) {
... or extend them if you want to add your own custom props in addition to those: import {AriaTextFieldProps} from '@react-types/textfield';
interface TextFieldProps extends AriaTextFieldProps {
// Your own custom props...
}
function TextField(props: TextFieldProps) {
... You can also look at how we do this in React Spectrum components for inspiration. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
PixeledCode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The link you posted isn't public. Would you be able to post a code snippet here?Update:
You'll want to add a type to the props:
or extend them if you want to add your own custom props in addition to those:
You can also look at how we do this in React Spectrum components for inspiration.