@@ -51,7 +51,7 @@ export interface ContextProp<Context> {
5151 * @see {@link VirtuosoProps.components } for usage in Virtuoso
5252 * @group Virtuoso
5353 */
54- export interface Components < Data = unknown , Context = unknown > {
54+ export interface Components < Data = unknown , Context = unknown , ListEl extends HTMLDivElement | HTMLUListElement = HTMLDivElement > {
5555 /**
5656 * Set to render a custom UI when the list is empty.
5757 */
@@ -79,7 +79,7 @@ export interface Components<Data = unknown, Context = unknown> {
7979 /**
8080 * Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
8181 */
82- List ?: React . ComponentType < ListProps & ContextProp < Context > >
82+ List ?: React . ComponentType < ListProps < ListEl > & ContextProp < Context > >
8383
8484 /**
8585 * Set to customize the outermost scrollable element. This should not be necessary in general,
@@ -203,7 +203,7 @@ export type FollowOutputScalarType = 'auto' | 'smooth' | boolean
203203 * @see {@link VirtuosoGridProps.components } for usage in VirtuosoGrid
204204 * @group VirtuosoGrid
205205 */
206- export interface GridComponents < Context = any > {
206+ export interface GridComponents < Context = any , ListEl extends HTMLDivElement | HTMLUListElement = HTMLDivElement > {
207207 /**
208208 * Set to render a component at the bottom of the list.
209209 */
@@ -224,7 +224,7 @@ export interface GridComponents<Context = any> {
224224 /**
225225 * Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
226226 */
227- List ?: React . ComponentType < GridListProps & ContextProp < Context > >
227+ List ?: React . ComponentType < GridListProps < ListEl > & ContextProp < Context > >
228228
229229 /**
230230 * Set to customize the outermost scrollable element. This should not be necessary in general,
@@ -297,8 +297,11 @@ export type GridItemProps = Pick<React.ComponentProps<'div'>, 'children' | 'clas
297297 * Passed to the GridComponents.List custom component
298298 * @group VirtuosoGrid
299299 */
300- export type GridListProps = Pick < React . ComponentProps < 'div' > , 'children' | 'className' | 'style' > &
301- React . RefAttributes < HTMLDivElement > & {
300+ export type GridListProps < El extends HTMLDivElement | HTMLUListElement = HTMLDivElement > = Pick <
301+ React . ComponentProps < 'div' > ,
302+ 'children' | 'className' | 'style'
303+ > &
304+ React . RefAttributes < El > & {
302305 'data-testid' : string
303306 }
304307
@@ -467,8 +470,11 @@ export type ListItem<Data> = GroupItem<Data> | RecordItem<Data>
467470 * Passed to the Components.List custom component
468471 * @group Virtuoso
469472 */
470- export type ListProps = Pick < React . ComponentProps < 'div' > , 'children' | 'style' > &
471- React . RefAttributes < HTMLDivElement > & {
473+ export type ListProps < El extends HTMLDivElement | HTMLUListElement = HTMLDivElement > = Pick <
474+ React . ComponentProps < 'div' > ,
475+ 'children' | 'style'
476+ > &
477+ React . RefAttributes < El > & {
472478 'data-testid' : string
473479 }
474480
0 commit comments