Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ink-table

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ink-table

A table component for Ink.

  • 3.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
144K
decreased by-2.14%
Maintainers
1
Weekly downloads
 
Created

What is ink-table?

The ink-table npm package is used to render tables in Ink applications. Ink is a React-like library for building command-line interfaces (CLIs). ink-table allows you to easily display tabular data in a visually appealing way within your CLI applications.

What are ink-table's main functionalities?

Basic Table Rendering

This feature allows you to render a basic table with rows and columns. The data is passed as an array of objects, where each object represents a row.

const { render } = require('ink');
const Table = require('ink-table').default;
const React = require('react');

const data = [
  { name: 'John Doe', age: 28 },
  { name: 'Jane Doe', age: 26 }
];

render(<Table data={data} />);

Custom Column Headers

This feature allows you to customize the column headers of the table. You can specify the header text and the key that corresponds to the data field.

const { render } = require('ink');
const Table = require('ink-table').default;
const React = require('react');

const data = [
  { name: 'John Doe', age: 28 },
  { name: 'Jane Doe', age: 26 }
];

const columns = [
  { header: 'Full Name', key: 'name' },
  { header: 'Age', key: 'age' }
];

render(<Table data={data} columns={columns} />);

Table with Custom Styles

This feature allows you to apply custom styles to the table. In this example, the table is wrapped in a Box component with a green border.

const { render } = require('ink');
const Table = require('ink-table').default;
const React = require('react');
const { Box } = require('ink');

const data = [
  { name: 'John Doe', age: 28 },
  { name: 'Jane Doe', age: 26 }
];

const CustomTable = () => (
  <Box borderStyle="round" borderColor="green">
    <Table data={data} />
  </Box>
);

render(<CustomTable />);

Other packages similar to ink-table

Keywords

FAQs

Package last updated on 06 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc