-
+
);
diff --git a/packages/ui/src/components/Menu/MenuAutocompleteListBox.stories.tsx b/packages/ui/src/components/Menu/MenuAutocompleteListBox.stories.tsx
index 733d813773..bf66f5f8fd 100644
--- a/packages/ui/src/components/Menu/MenuAutocompleteListBox.stories.tsx
+++ b/packages/ui/src/components/Menu/MenuAutocompleteListBox.stories.tsx
@@ -24,7 +24,7 @@ import {
SubmenuTrigger,
} from './index';
import { Button, Flex, Text } from '../..';
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
import { Selection } from 'react-aria-components';
import { MemoryRouter } from 'react-router-dom';
@@ -183,3 +183,82 @@ export const Submenu: Story = {
);
},
};
+
+export const Virtualized: Story = {
+ args: {
+ ...Default.args,
+ },
+ render: () => {
+ const [pokemon, setPokemon] = useState<
+ Array<{ name: string; url: string }>
+ >([]);
+
+ useEffect(() => {
+ fetch('https://pokeapi.co/api/v2/pokemon?limit=1000')
+ .then(response => response.json())
+ .then(data => {
+ setPokemon(data.results);
+ })
+ .catch(error => {
+ console.error('Error fetching Pokemon:', error);
+ });
+ }, []);
+
+ return (
+
+
+
+ {pokemon.map((p, index) => (
+
+ {p.name.charAt(0).toLocaleUpperCase('en-US') + p.name.slice(1)}
+
+ ))}
+
+
+ );
+ },
+};
+
+export const VirtualizedMaxHeight: Story = {
+ args: {
+ ...Default.args,
+ },
+ render: () => {
+ const [pokemon, setPokemon] = useState<
+ Array<{ name: string; url: string }>
+ >([]);
+
+ useEffect(() => {
+ fetch('https://pokeapi.co/api/v2/pokemon?limit=1000')
+ .then(response => response.json())
+ .then(data => {
+ setPokemon(data.results);
+ })
+ .catch(error => {
+ console.error('Error fetching Pokemon:', error);
+ });
+ }, []);
+
+ return (
+
+
+
+ {pokemon.map((p, index) => (
+
+ {p.name.charAt(0).toLocaleUpperCase('en-US') + p.name.slice(1)}
+
+ ))}
+
+
+ );
+ },
+};
diff --git a/packages/ui/src/components/Menu/MenuListBox.stories.tsx b/packages/ui/src/components/Menu/MenuListBox.stories.tsx
index 68aa071faf..72284fb6b9 100644
--- a/packages/ui/src/components/Menu/MenuListBox.stories.tsx
+++ b/packages/ui/src/components/Menu/MenuListBox.stories.tsx
@@ -17,7 +17,7 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { MenuTrigger, MenuListBox, MenuListBoxItem } from './index';
import { Button, Flex, Text } from '../..';
-import { useState } from 'react';
+import { useEffect, useState } from 'react';
import { Selection } from 'react-aria-components';
import { MemoryRouter } from 'react-router-dom';
@@ -87,3 +87,73 @@ export const Controlled: Story = {
);
},
};
+
+export const Virtualized: Story = {
+ args: {
+ ...Default.args,
+ },
+ render: () => {
+ const [pokemon, setPokemon] = useState<
+ Array<{ name: string; url: string }>
+ >([]);
+
+ useEffect(() => {
+ fetch('https://pokeapi.co/api/v2/pokemon?limit=1000')
+ .then(response => response.json())
+ .then(data => {
+ setPokemon(data.results);
+ })
+ .catch(error => {
+ console.error('Error fetching Pokemon:', error);
+ });
+ }, []);
+
+ return (
+
+
+
+ {pokemon.map((p, index) => (
+
+ {p.name.charAt(0).toLocaleUpperCase('en-US') + p.name.slice(1)}
+
+ ))}
+
+
+ );
+ },
+};
+
+export const VirtualizedMaxHeight: Story = {
+ args: {
+ ...Default.args,
+ },
+ render: () => {
+ const [pokemon, setPokemon] = useState<
+ Array<{ name: string; url: string }>
+ >([]);
+
+ useEffect(() => {
+ fetch('https://pokeapi.co/api/v2/pokemon?limit=1000')
+ .then(response => response.json())
+ .then(data => {
+ setPokemon(data.results);
+ })
+ .catch(error => {
+ console.error('Error fetching Pokemon:', error);
+ });
+ }, []);
+
+ return (
+
+
+
+ {pokemon.map((p, index) => (
+
+ {p.name.charAt(0).toLocaleUpperCase('en-US') + p.name.slice(1)}
+
+ ))}
+
+
+ );
+ },
+};
diff --git a/packages/ui/src/components/Menu/types.ts b/packages/ui/src/components/Menu/types.ts
index caf90742a8..6d4852a4b3 100644
--- a/packages/ui/src/components/Menu/types.ts
+++ b/packages/ui/src/components/Menu/types.ts
@@ -37,6 +37,9 @@ export interface MenuProps
extends RAMenuProps,
Omit, 'children'> {
placement?: RAPopoverProps['placement'];
+ virtualized?: boolean;
+ maxWidth?: string;
+ maxHeight?: string;
}
/** @public */
@@ -44,6 +47,9 @@ export interface MenuListBoxProps
extends RAListBoxProps,
Omit, 'children'> {
placement?: RAPopoverProps['placement'];
+ virtualized?: boolean;
+ maxWidth?: string;
+ maxHeight?: string;
}
/** @public */
@@ -63,6 +69,9 @@ export interface MenuAutocompleteListBoxProps
Omit, 'children'> {
placeholder?: string;
placement?: RAPopoverProps['placement'];
+ virtualized?: boolean;
+ maxWidth?: string;
+ maxHeight?: string;
}
/** @public */