UNPKG

ink-spreadsheet

Version:

An ink component to render a spreadsheet to the terminal

36 lines (31 loc) 876 B
import * as react_jsx_runtime from 'react/jsx-runtime'; interface ColumnDef { header: string; key: string; } interface Props { columns: ColumnDef[]; data: Record<string, any>[]; } /** * @example * const columnHelper = createColumnHelper<Entity>(); * const columns = [ * columnHelper('name'), * columnHelper('email', { * header: 'Email' * }), * ]; * * export function MyComponent() { * return ( * <Spreadsheet columns={columns} data={[]} /> * ) * } */ declare function Spreadsheet({ data, columns }: Props): react_jsx_runtime.JSX.Element; interface CreateColumnHelperOptions { header: string; } declare function createColumnHelper<TDataType>(): (accessor: keyof TDataType extends string ? keyof TDataType : never, options?: CreateColumnHelperOptions) => ColumnDef; export { createColumnHelper, Spreadsheet as default };