[Autocomplete] - Passing props to ListboxComponent
See original GitHub issueNot sure if this is a bug or not.
I am trying to fetch more options when ListboxComponent scroll is at the bottom. Having issues with the custom ListboxComponent.
When I pass props I get a fowardRef warning and the list items won’t render correctly even tho fowardRef was used.
ListboxComponent={listboxProps => (
<ListboxComponent
{...listboxProps}
setIsScrollBottom={setIsScrollBottom}
/>
)}
const ListboxComponent = forwardRef(function ListboxComponent({ setIsScrollBottom, ...rest }, ref) {
return (
<ul
ref={ref}
{...rest}
onScroll={({ target }) =>
setIsScrollBottom(target.scrollHeight - target.scrollTop === target.clientHeight)
}
/>
);
});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:19 (15 by maintainers)
Top Results From Across the Web
Passing props to ListboxComponent #18822 - mui/material-ui
I am trying to fetch more options when ListboxComponent scroll is at the ... [Autocomplete] - Passing props to ListboxComponent #18822.
Read more >MUI Autocomplete - render image in list - Stack Overflow
I figured this out: I just needed to add a custom ListboxComponent and pass it to the Autocomplete . Here's the custom component:...
Read more >How to Style the Material-UI Autocomplete Component
Create a custom Popper and pass classes to it in the v4 style. I will show both techniques below. MUI v5 Autocomplete ListboxProps....
Read more >A Guide on Material UI AutoComplete in React - Refine Dev
We'll discover the Material UI (MUI) AutoComplete component with examples. ... Getting Started with MUI Autocomplete; MUI Autocomplete props.
Read more >Customizing the Material-UI Autocomplete Component
Do you want to build a full MUI app from beginning to end, learn every aspect of the sx prop, styled API, and...
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 Free
Top 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
After X long hours spent on trying do ‘hacks’ with scroll/fix warning type listBoxComponent props i couldn’t find any working way do handle that… the way which i’ve chosen is to use hook useAutocomplete and provide custom list box build based on material-ui components like
<Typography component='li' />(i wanted have the same style/look like material-ui autocomplete)there is a good example (easy to convert to TypeScript) https://codesandbox.io/s/material-demo-0fbyb?file=/demo.js
in my case i only imported getRootProps( for parent div), getInputProps( for inputProps TextField) and everything works