1.0.0 • Published 2 years ago

@inkkit/ink-image v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ink-image

Image component for Ink 4

Install

$ npm install @inkkit/ink-image

Usage

import React from 'react';
import { render } from 'ink';
import Image from '@inkkit/ink-image';

const Demo = () => {
  return <Image src="image.jpg" />;
};

render(<Demo />);

Props

src

Type: string

Path to the image. Can be either a local path or a URL.

width

Type: number

Width of the image in characters. Leave empty to automatically detect width based on terminal size. If the value is greater than terminal width, the image will be scaled down.

height

Type: number

Height of the image in characters. Leave empty to automatically detect height based on terminal size. If the value is greater than terminal height, the image will be scaled down.

onError

Type: function

Callback function called when an error occurs while loading the image.

onLoad

Type: function

Callback function called when the image is loaded.

1.0.0

2 years ago