@@ -46,12 +46,32 @@ async function main() {
4646 });
4747 console.log(`Selected model: ${model}`);
4848
49- console.log("\n=== Many items (overflow test) ===");
50- const items = Array.from(
51- { length: 30 },
52- (_, i) => `item-${String(i + 1).padStart(2, "0")}`,
49+ console.log("\n=== Scrollable list browsing ===");
50+ console.log(
51+ c.dim(" Use ↑/↓ to scroll through all 50 items, Home/End to jump\n"),
5352 );
54- const item = await select({ items, maxVisible: 5 });
53+ const colors = [
54+ "red",
55+ "orange",
56+ "yellow",
57+ "green",
58+ "blue",
59+ "indigo",
60+ "violet",
61+ ];
62+ const items = Array.from({ length: 50 }, (_, i) => {
63+ const color = colors[i % colors.length] as string;
64+ return {
65+ label: `${color}-${String(i + 1).padStart(2, "0")} ${c.dim(`shade ${i + 1}`)}`,
66+ value: `${color}-${i + 1}`,
67+ filterText: `${color} ${i + 1}`,
68+ };
69+ });
70+ const item = await select({
71+ items,
72+ maxVisible: 8,
73+ placeholder: "browse or type to filter...",
74+ });
5575 console.log(`Selected: ${item}`);
5676 }