Renders a virtualized, scrollable list of AI model options for an endpoint menu, supporting favorites toggling and keyboard navigation. Reuse for large selectable lists needing performance optimization.
// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { useCallback, useEffect, useMemo, useRef } from 'react';
import * as Ariakit from '@ariakit/react';
import { useRemScale } from '@librechat/client';
import { AutoSizer, List } from 'react-virtualized';
import type { ListRowProps } from 'react-virtualized';
import type { Endpoint } from '~/common';
import { EndpointModelItem } from './EndpointModelItem';
/** Matches the rendered height of a `CustomMenuItem` row (px-2 py-1 around a py-1 body). */
const ROW_HEIGHT = 36;
const MAX_LIST_HEIGHT = 320;
const OVERSCAN = 8;
interface VirtualizedModelListProps {
endpoint: Endpoint;
modelIds: string[];
globalByName: Map<string,
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key