Framework for fast, native code, cross-platform GUI applications.


Revery is a framework for building cross-platform GUI applications. Revery provides a React-like, functional approach for modeling UI, as well as scaffolding for managing the application lifecycle.

Revery started as the foundation of Onivim 2, but was factored out into a general toolkit for ReasonML user interfaces.


There are two ways to get started:

Component Model

Basic Components

The basic component building block is simply a pure function, that returns an element.


let squareBox = (~children as _, ()) => <Container width=10 height=10 />;

Properties can be specified as named arguments.


let wideBox = (~children as _, ~width: int, ()) => <Container width height=10 />;

Note that the ~children as _ is used to ignore the children argument when it is not used (otherwise, there will be a compiler warning.)

You may instead decide you wish to render the children, for example:

let boxWithChildren = (~children, ()) => <Container width=10 height=10>children</Container>;

Components with Hooks

For components that manage state, or have side effects, you'll want to encapsulate those using hooks!

A component that uses hooks must create a handle via React.component, for example:

let componentWithHooks = {
    let component = React.component("componentWithHooks");
    (~children, ()) => component(hooks => {
       let (state, setState, hooks) = Hooks.state(0, hooks);

       (hooks, <Button text=string_of_int(state) onClick={(_) => setState(state + 1)}/>)

Hooks components still return a function with named arguments representing the properties, but there is a nested call to component(hooks => ... - a hooks component is a function that takes a hooks object, and then returns a tuple of (hooks, element).

In effect, Revery components should always be pure functions - given a set of props, and a hooks, the output should always be the same.