JSPM

ink-use-stdout-dimensions

1.0.5
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 183795
  • Score
    100M100P100Q188646F
  • License MIT

React hook for subscribing to stdout dimensions in Ink

Package Exports

  • ink-use-stdout-dimensions

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ink-use-stdout-dimensions) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ink-use-stdout-dimensions

React hook for subscribing to stdout dimensions in Ink

Install

$ npm install ink-use-stdout-dimensions
$ yarn add ink-use-stdout-dimensions

Usage

import React from 'react';
import { render } from 'ink';
import useStdoutDimensions from 'ink-use-stdout-dimensions';

function Application() {
  const [columns, rows] = useStdoutDimensions();
  return (
    <Text>
      {columns}×{rows}
    </Text>
  );
}

render(<Application />);

Demo of ink-use-stdout-dimensions

API

useStdoutDimensions(): [number, number]

Returns initial stdout columns and rows and updates values on resize events.

License

MIT © Cameron Hunter