You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I'm trying to implement an autocomplete for a list of users. My issues is that I want to use item.name prop as display value but internally the real value should be item.id. Is there a way to do that? I tried to pass on the AutocompleteItem value={item.id} and keep textValue={item.name} but it doesn't work.
<Autocompleteid={fields.clientId.id}name={fields.clientId.name}defaultItems={clients}label='Client'labelPlacement='outside'allowsCustomValueplaceholder='Select a client'size='lg'isLoading={fetcher.state==='loading'}errorMessage={fields.clientId.errors}startContent={<UserIconclassName='w-5 text-default-400 pointer-events-none flex-shrink-0'/>}scrollRef={scrollerRef}onInputChange={load}onOpenChange={setIsClientsAutocompleteOpen}>{item=>(<AutocompleteItemkey={item.id}textValue={item.name}><UseravatarProps={{src: item.avatarUrl??'',}}name={item.name}description={item.createdAt}/></AutocompleteItem>)}</Autocomplete>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello I'm trying to implement an autocomplete for a list of users. My issues is that I want to use
item.name
prop as display value but internally the real value should beitem.id
. Is there a way to do that? I tried to pass on the AutocompleteItemvalue={item.id}
and keeptextValue={item.name}
but it doesn't work.Beta Was this translation helpful? Give feedback.
All reactions