Skip to content

brigand/ink-progress-bar

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
Apr 12, 2019
Jul 9, 2017
Jul 9, 2017
Jul 9, 2017

ink-progress-bar

Build Status

Progress bar component for Ink.

Install

$ npm install ink-progress-bar

Usage

See examples/basic.js for an example app. Run it with ./examples/run basic.

import React, { Component } from 'react';
import { Color } from 'ink';
import ProgressBar from 'ink-progress-bar';

class MyProgress extends Component {
  render() {
    return (
      <>
        <Color red>
          <ProgressBar
            left={text.length}
            percent={this.state.done / TASKS}
          />
        </Color>
      </>
    );
  }
}

Props

All props except the ones below are passed to <Text> as-is.

character

Type: string
Default: '█'

The character to use for each step.

percent

Type: number
Default: 0

The percentage (between 0 and 1) of progress.

left

right

Type: number
Default: 0

The number of characters to subtract from each side of the progress bar. Commonly used if you want text before/after the progress bar on the same line. See examples/basic.js for an example.

License

MIT © Frankie Bagnardi

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published