Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

narraleaf-react

helloyork316MPL-2.00.6.0TypeScript support: included

A React visual novel player framework

react, visual-novel, typescript, component, narraleaf, nvl

readme

<picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-transparent.png"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/NarraLeaf/.github/refs/heads/master/doc/banner-md-light.png"> NarraLeaf Logo </picture>

NarraLeaf-React

A React visual novel player framework

English | 简体中文

What is NarraLeaf-React?

NarraLeaf-React is a lightweight front-end visual novel player.
NL focuses on visual novel playing, so the user interface can be customized very easily.

It doesn't use any rendering libraries and can be used on any web platform (e.g. Electron)

Why NarraLeaf-React?

  • Lightweight: NarraLeaf-React is a front-end framework, and it doesn't use any rendering libraries.
  • Customizable: You can customize the UI as you like, even replace the whole components.
  • Easy to use: It is easy to use and has a simple API that is built for developers. Based on OOP principles.

Scripting

NarraLeaf-React uses TypeScript for all scripting, so you don't have to learn a whole new language to use it.

It also has a highly abstracted and easy-to-use API, for example:

import {Character, Menu, Scene, c, b} from "narraleaf-react";
const scene1 = new Scene("Scene1: Hello World", {
  background: "/link/to/background.jpg",
});

const jS = new Character("John Smith");
const jD = new Character("John Doe");

scene1.action([
  jS`Hello, world!`,
  jS`This is my first ${b("NarraLeaf")} story.`,
  jS`Start editing ${c("src/story.js", "#00f")} and enjoy the journey!`,

  jD`Also, don't forget to check out the ${c("documentation", "#00f")}!`,

  "By the way, the documentation is available on https://react.narraleaf.com/documentation",
  "You can also visit the website for demo and more information.",

  Menu.prompt("Start the journey")

    .choose("Yes I will!", [
      jS`Great! Let's start the journey!`,
      jS`You can open issues on GitHub if you have any questions.`
    ])

    .choose("No, I'm going to check the documentation", [
      jS`Sure! Take your time!`
    ])
]);

For more information, please visit 🛠React.NarraLeaf.com

Get Started

Install

npm install narraleaf-react

Documentation

Read more in 🛠React.NarraLeaf.com

License

NarraLeaf-React is licensed under the MPL-2.0 License.

We updated the license to MPL-2.0 on 2024-9-24.

Contributing

We welcome all contributions.
If you have any ideas, just open an issue or a pull request.