@xv-town/ink-input-select
1.0.2 • Public • Published
@xv-town/ink-input-select
Usage
import { render, Text } from 'ink';
import React, { useState } from 'react';
import SelectInput from '@xv-town/ink-select-input';
const Demo = () => {
const [result, setResult] = useState(null);
const handleSelect = item => {
setResult(item);
};
const items = Array.from(Array(10).keys()).map(item => ({
value: item,
label: item,
}));
return result ? (
<Text>{JSON.stringify(result)}</Text>
) : (
<SelectInput options={items} onSelect={handleSelect} />
);
};
render(<Demo />);
Options
attribute |
description |
type |
default |
options |
Items to display in a list. |
ItemProps[] |
[] |
initialIndex |
Index of initially-selected item in items array. |
number |
0 |
limit |
Number of items to display. |
number |
8 |
onSelect |
Function to call when user selects an item. |
function |
- |
Package Sidebar
Install
npm i @xv-town/ink-input-select
Weekly Downloads