Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cometkim/rescript-ink

Open more actions menu

Repository files navigation

ReScript Ink

npm license

ReScript bindings for Ink

Let's build interactive & sound CLI with React and ReScript!

Features

Core

Core:

  • render
  • ref & measureElement

Components:

  • Box
  • Text
  • Newline
  • Spacer
  • Static
  • Transform

Hooks:

  • useApp
  • useInput
  • useFocus
  • useFocusManager
  • useStdin
  • useStdout
  • useStderr

Do you find any missing APIs? Let me know!

👯 Community components bindings

Requirements

  • Ink v3.0.0 or higher
  • ReScript v9.1.0 or higher

Install

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

Add it to your bsconfig.json

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

Example

open Ink;

// Community bindings have `InkCommunity_` prefix.
module BigText = InkCommunity_BigText;

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

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

See more in examples

Contributing

Any feedbacks & contributions are welcome!

See more details in CONTRIBUTING

License

MIT

Releases

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.