
Research
/Security News
16 Malicious Firefox Extensions Steal Cryptocurrency Wallet Credentials
Socket found 16 malicious Firefox extensions designed to steal crypto wallet recovery phrases and private keys using cloned Rabby and OKX interfaces.
ink-scroll-view
Advanced tools
A robust, performance-optimized ScrollView component for Ink CLI applications.
overflow and offsets, ensuring correct layout without layout thrashing.npm install ink-scroll-view
# Peer dependencies
npm install ink react
ScrollView is a layout primitive. It does not capture user input automatically. You must control it programmatically using React refs and Ink's useInput.
import React, { useRef, useEffect } from "react";
import { render, Text, Box, useInput, useStdout } from "ink";
import { ScrollView, ScrollViewRef } from "ink-scroll-view";
const App = () => {
const scrollRef = useRef<ScrollViewRef>(null);
const { stdout } = useStdout();
// 1. Handle Terminal Resizing due to manual window change
useEffect(() => {
const handleResize = () => scrollRef.current?.remeasure();
stdout?.on("resize", handleResize);
return () => {
stdout?.off("resize", handleResize);
};
}, [stdout]);
// 2. Handle Keyboard Input
useInput((input, key) => {
if (key.upArrow) {
scrollRef.current?.scrollBy(-1); // Scroll up 1 line
}
if (key.downArrow) {
scrollRef.current?.scrollBy(1); // Scroll down 1 line
}
if (key.pageUp) {
// Scroll up by viewport height
const height = scrollRef.current?.getViewportHeight() || 1;
scrollRef.current?.scrollBy(-height);
}
if (key.pageDown) {
const height = scrollRef.current?.getViewportHeight() || 1;
scrollRef.current?.scrollBy(height);
}
});
return (
<Box
height={10}
width="100%"
borderStyle="single"
borderColor="green"
flexDirection="column"
>
<ScrollView ref={scrollRef}>
{Array.from({ length: 50 }).map((_, i) => (
<Text key={i}>Item {i + 1} - content with variable length...</Text>
))}
</ScrollView>
</Box>
);
};
render(<App />);
The component renders all children into a container but shifts the content vertically using marginTop. The parent box with overflow="hidden" acts as the "viewport".
┌─────────────────────────┐
│ (hidden content) │ ← Content above viewport
│ ... │
├─────────────────────────┤ ← scrollOffset (distance from top)
│ ┌───────────────────┐ │
│ │ Visible Viewport │ │ ← What user sees
│ │ │ │
│ └───────────────────┘ │
├─────────────────────────┤
│ (hidden content) │ ← Content below viewport
│ ... │
└─────────────────────────┘
ScrollViewProps)Inherits standard BoxProps from Ink.
| Prop | Type | Description |
|---|---|---|
children | ReactElement[] | Required. List of child elements. Must use unique keys (strings/numbers). |
onScroll | (offset: number) => void | Called when scroll position changes. |
onViewportSizeChange | (layout: { width, height }) => void | Called when the viewport dimensions change. |
onContentHeightChange | (height: number) => void | Called when the total content height changes. |
onItemHeightChange | (index: number, height: number) => void | Called when an individual item's height changes. |
| ... | BoxProps | Any other prop accepted by Ink's Box. |
ScrollViewRef)Access these via ref.current.
| Method | Signature | Description |
|---|---|---|
scrollTo | (offset: number) => void | Scrolls to an absolute Y offset from the top. |
scrollBy | (delta: number) => void | Scrolls by a relative amount (negative = up, positive = down). |
scrollToTop | () => void | Helper to scroll to offset 0. |
scrollToBottom | () => void | Helper to scroll to the maximum possible offset (contentHeight - viewportHeight). |
getScrollOffset | () => number | Returns the current scroll offset. |
getContentHeight | () => number | Returns the total height of all content items. |
getViewportHeight | () => number | Returns the current height of the visible area. |
getItemHeight | (index: number) => number | Returns the measured height of a specific item by its index. |
getItemPosition | (index: number) => { top, height } | Returns the position (top offset) and height of a specific item. |
remeasure | () => void | Re-checks viewport dimensions. Must call this on terminal resize. |
remeasureItem | (index: number) => void | Forces a specific child to re-measure. Useful for dynamic content (expand/collapse) that doesn't trigger a full re-render. |
key props (strings or numbers) to your children. This allows ScrollView to accurately track height changes even when items are re-ordered or removed.process.stdout's resize event and call remeasure() on the ref.remeasureItem(index) is more efficient than forcing a full update.MIT
FAQs
A ScrollView component for Ink CLI applications
The npm package ink-scroll-view receives a total of 235,827 weekly downloads. As such, ink-scroll-view popularity was classified as popular.
We found that ink-scroll-view demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Research
/Security News
Socket found 16 malicious Firefox extensions designed to steal crypto wallet recovery phrases and private keys using cloned Rabby and OKX interfaces.

Product
Socket now scans VS Code extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Research
/Security News
Socket uncovered two malicious VS Code themes in a GlassWorm-linked cluster with thousands of installs across VS Code Marketplace and Open VSX.