6 releases (3 breaking)

0.4.0 Dec 2, 2020
0.3.2 Oct 20, 2020
0.2.0 Oct 10, 2020
0.1.0 Sep 25, 2020

#11 in #polyhorn

Download history 9/week @ 2024-01-06 5/week @ 2024-01-13 3/week @ 2024-01-20 13/week @ 2024-02-03 12/week @ 2024-02-10 14/week @ 2024-02-17 27/week @ 2024-02-24 25/week @ 2024-03-02 32/week @ 2024-03-09 20/week @ 2024-03-16 23/week @ 2024-03-23 68/week @ 2024-03-30 22/week @ 2024-04-06 28/week @ 2024-04-13 16/week @ 2024-04-20

134 downloads per month
Used in 11 crates (6 directly)

MIT license



A library for rapidly building cross-platform apps in Rust 🦀.

Polyhorn is a Rust library for building user interfaces. For users familiar with React or React Native, this library will be very similar in purpose.

It also comes with its own command line interface that makes it easy to start a new project and to build and run existing projects.

Colloquially, both are called Polyhorn.

🚧 Warning: Polyhorn is still very much a work-in-progress, which means that there will probably be many breaking changes and missing features before its official launch (sorry for this).

Get Started


Installation of Polyhorn is easy and takes just a few seconds. If you're new to Rust, you also need to install Rust first with step 1 below. If you're already using Rust, you can skip step 1 and install Polyhorn with step 2.

  1. If you don't already have Rust installed, install Rust with rustup.

    $ curl -sSf https://sh.rustup.rs | sh
  2. Now, install Polyhorn with cargo, the Rust-provided package manager.

    $ cargo install polyhorn

Start a Project

Starting a new project from one of our built-in templates is easy. For an almost blank project, run:

$ polyhorn new hello-world

You can replace hello-world with the name of your app. Make sure it contains only alphanumerical characters and dashes.

This will generate a directory with the following structure:

├── .gitignore
├── assets
│   └── .gitkeep
└── src
    └── lib.rs

This is the content of src/lib.rs:

use polyhorn::prelude::*;

pub struct App {}

impl Component for App {
    fn render(&self, _manager: &mut Manager) -> Element {
            <View style=!{
                align-items: center;
                justify-content: center;
                background-color: red;
                height: 100%;
                <Text style=!{ color: white; }>
                    "Welcome to your Polyhorn app!"

polyhorn::render!(<App />);

Run a Project

In your command line, navigate to your project. For example, if you followed the instructions above, you should now be in hello-world/. Then, decide on which platform you want to run. Note that all platforms share the same codebase, so you don't need to plan ahead.

Running on iOS

If you want to run your app on an iOS simulator, run this command:

$ polyhorn run ios

It will ask you to select an available simulator.


~23K SLoC