Is it possible to prepend custom elements to the list?
See original GitHub issueIt would be helpful to add a search bar for example, similarly to what twitter does for messages search:

In reactWindow I used to do it this way:
- Add a paddingTop to the list
const Item = ({ index, style }) => {
const item = items[index];
return (
<div
style={{
...style,
top: `${parseFloat(style.top) + topPadding}px`
}}
>
<ItemRendrer item={item} />
</div>
);
};
- Then, using the list container renderer, I place the customElement at top of the list
const innerElementType = React.forwardRef(({ style, ...rest }, ref) => (
<div>
{customElement}
<div
ref={ref}
style={{
...style,
height: `${parseFloat(style.height) + topPadding}px`
}}
{...rest}
/>
</div>
));
My first reaction was trying to replicate the same workaround in Virtuoso but found that the style is not passed down as a prop in ItemRendrer. Maybe there is a better/cleaner way.
Thank you by the way for the this awesome piece of software!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Is it possible to add elements within a custom element without ...
Basically, the custom element has to be able to have any number of elements within, like an unordered list ( <ul> ) which...
Read more >Element.prepend() - Web APIs - MDN Web Docs
The Element.prepend() method inserts a set of Node objects or string objects before the first child of the Element.
Read more >Custom elements - The Modern JavaScript Tutorial
We can create custom HTML elements, described by our class, with its own methods and properties, ... Here's a sketch with the full...
Read more >.prepend() | jQuery API Documentation
A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at the beginning of each element in...
Read more >Python List .append() – How to Add an Item to a List in Python
list.insert() – inserts a single element anywhere in the list. · list.append() – always adds items (strings, numbers, lists) at the end of...
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

I am considering an optional header component, in the same way as the footer. Meanwhile, you can easily do something like this (which is not very elegant, but works:): https://stackblitz.com/edit/react-y6fim2?file=example.js
Let me know what you think about it.
@mdegrees - no, not a good idea.