Git Product home page Git Product logo

qp-xtermjs's Introduction

QPXterm

Install

$ npm i qp-xtermjs

Basic

import React, { useCallback, useRef } from 'react';
import { QPXterm } from 'qp-xtermjs';

const HelloWorld: React.FC = () => {
  const terminalRef = useRef<QPXterm | null>();

  const onDidMount = useCallback((terminal: QPXterm) => {
    terminalRef.current = terminal;
    terminalRef.current?.setMessage(['Hello World', 'https://querypie.com']);
  }, []);

  return (
    <>
      <QPXterm onDidMount={onDidMount} style={{ height: 150 }} />
    </>
  );
};

export default HelloWorld;

CustomStyle

import React, { useCallback, useRef } from 'react';
import { QPXterm } from 'qp-xtermjs';

const CustomStyle: React.FC = () => {
  const terminalRef = useRef<QPXterm | null>();

  const onDidMount = useCallback((terminal: QPXterm) => {
    terminalRef.current = terminal;
    terminalRef.current?.setMessage(
      [
        '<greenBold>Hello</greenBold><blue>World</blue>',
        '<cyan>miniature bicycles</cyan> 특가를 찾고 계신가요? ' +
          '<redBold>AliExpress</redBold>에서 다양한 <blueUnderscore>miniature bicycles</blueUnderscore> 상품을 탐색하며 ' +
          '<purpleItalic>고객님</purpleItalic>께 꼭 맞는 <blackItalic>베스트 상품</blackItalic>을 만나보세요! ' +
          '<redItalic>빅 세일 기간 동안</redItalic> miniature bicycles 상품을 쇼핑하시면 고품질 브랜드뿐만 아니라 초특가 할인 혜택까지 즐기실 수 있답니다. ' +
          '가장 중요한 단계가 있어요! <yellowUnderscore>최고의 온라인 쇼핑</yellowUnderscore>을 즐기기 위해 무료 배송이나 무료 반품과 같은 보너스 혜택으로 상품을 필터링하는 것, 꼭 잊지 마세요:) miniature bicycles 관련 아이템',
      ],
      {
        useTemplate: true,
      },
    );
  }, []);

  return (
    <QPXterm
      onDidMount={onDidMount}
      style={{
        height: 200,
      }}
      options={{
        fontSize: 12,
        fontWeight: '400',
        theme: {
          foreground: '#000',
          background: '#eeeeee',
          green: '#006400',
          brightGreen: '#006400',
        },
      }}
    />
  );
};

export default CustomStyle;

qp-xtermjs's People

Contributors

covy-jo avatar dependabot[bot] avatar thomasjang avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.