1.0.0 • Published 4 years ago

@reason-ink/ink-text-input v1.0.0

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

reason-ink

npm GitHub

ReasonML (BuckleScript) binding for Ink

Let's build interactive CLI with React and ReasonML!

Supports

Core

Core:

  • render

Context:

  • StdinContext
  • StdoutContext
  • StderrContext

Components:

  • App
  • Box
  • Color
  • Text
  • Static
  • Transform

Hooks:

  • useApp
  • useInput
  • useStdin
  • useStdout
  • useStderr

Do you find any missing APIs? Let me know!

:dancers: Community bindings

Requirements

  • BuckleScript v7.3.0 or higher (to compile unit as undefined value)
  • Reason React v0.7.0 or higher (to use hooks)

Install

yarn add reason-react reason-ink \
  # You can install additional community bindings \
  @reason-ink/ink-big-text

Add it to your bsconfig.json

  "bs-dependencies": [
+   "reason-react",
+   "reason-ink",
+   "@reason-ink/ink-big-text
  ]

Example

open ReasonInk;

// Community bindings have `ReasonInkCommunity_` prefix.
module BigText = ReasonInkCommunity_BigText;

module App = {
  [@react.component]
  let make = () => {
    <Box display=`flex justifyContent=`center>
      <BigText text="Hello, Reason-Ink!"/>
    </Box>
  };
};

let root = <App/>;
let {waitUntilExit} = root->render(~exitOnCtrlC=true, ());
waitUntilExit();

See more in examples

Contributing

Any feedbacks & contributions are welcome!

See more details in CONTRIBUTING

License

See LICENSE