Cross-platform user interface framework for Rust.

Overview

Cross-platform user interface framework for Rust.

This crate provides an HTML-like render API for the backend of a UI. It's built for use as a backend for concoct, but you can bring your own state management tools or build your own framework using this as a backend.

Features

  • Cross-platform with desktop and mobile support
  • Event handling with an HTML-like API
  • CSS flexbox and grid layout with taffy
  • Accessibility with accesskit
  • High performance rendering with rust-skia

Getting started

Instatllation is simple with:

cargo add viewbuilder

If you encounter errors, please check the instructions for building rust-skia.

Examples

Hello World

fn app(cx: &mut Context) -> NodeKey {
    Element::new()
        .align_items(AlignItems::Center)
        .justify_content(JustifyContent::Center)
        .child(cx.insert("Hello World!"))
        .build(cx)
}

fn main() {
    viewbuilder::run(app)
}

Scroll

fn app(cx: &mut Context) -> NodeKey {
    let mut elem = Element::new();
    elem.overflow_y(Overflow::Scroll)
        .flex_direction(FlexDirection::Column)
        .extend((0..100).map(|count| cx.insert(count.to_string())));
    elem.build(cx)
}

Button Component

fn button(
    cx: &mut Context,
    label: &'static str,
    mut handler: impl FnMut(&mut Context) + 'static,
) -> NodeKey {
    Element::new()
        .on_click(Box::new(move |cx, _event| handler(cx)))
        .background_color(Color4f::new(1., 1., 0., 1.))
        .child(cx.insert(label))
        .build(cx)
}
You might also like...
Built on the Substrate-based runtime, this repository develops the Paralink Network, a cross-chain Oracle platform for secure and scalable data integration. Our goal is to create a robust infrastructure that ensures efficient and reliable data transmission across blockchain networks.
Glommio Messaging Framework (GMF) is a high-performance RPC system designed to work with the Glommio framework.

Glommio Messaging Framework (GMF) The GMF library is a powerful and innovative framework developed for facilitating Remote Procedure Calls (RPCs) in R

EXPERIMENTAL: Bitcoin Core Prometheus exporter based on User-Space, Statically Defined Tracing and eBPF.

bitcoind-observer An experimental Prometheus metric exporter for Bitcoin Core based on Userspace, Statically Defined Tracing and eBPF. This demo is ba

Unified directories for different use cases of an application, providing standard directories for local development, when run as service or when run by a user.

UniDirs Unified directories for different use cases of an application, providing standard directories for local development, when run as service or wh

LibreAuth is a collection of tools for user authentication.

LibreAuth is a collection of tools for user authentication. Features Password / passphrase authentication no character-set limitation reason

User-friendly secure computation engine based on secure multi-party computation
User-friendly secure computation engine based on secure multi-party computation

CipherCore If you have any questions, or, more generally, would like to discuss CipherCore, please join the Slack community. See a vastly extended ver

MevWallet is a smart contract wallet that allows the user to capture MEV from Searchers, or create MEV on purpose.

MevWallet MevWallet is a smart contract wallet that allows the user to capture MEV from Searchers, or create MEV on purpose. This repo contains the so

Fast & reliable user space NAT64

protomask A user space NAT64 implementation. Protomask started as a challenge to create a NAT64 implementation in a weekend. The goal of protomask is

Simple Multi-User Chat

4at Simple Multi-User Chat. The code has fallen to "Rewrite it in Rust" disease. You can find the legacy Go version in ./legacy-go-version if you stil

Owner
null
Web user interface for controlling a CATS Radio node

CATS Radio Node This project contains a web user interface for controlling a CATS Radio device, consisting of a Raspberry Pi with a RF4463 hat. Goals

Matthias P. Braendli 4 Feb 25, 2024
The protocol are designed and made for the future of cross-IP, cross-chain metaverse.

Avatar-protocol 化身协议 This project demonstrates how to use the Solana Javascript API to interact with programs on the Solana blockchain. The project co

Wind-protocol 1 Jan 10, 2022
Cross-platform atomic wait and wake (aka futex) functionality for Rust.

Cross platform atomic wait and wake (aka futex) functionality. This crate only supports functionality that's available on all of Linux, Windows, and m

Mara Bos 38 Dec 15, 2022
Cross-platform Secure TUI Secret Locker

SafeCloset keeps your secrets in password protected files. SafeCloset is designed to be convenient and avoid common weaknesses like external editing o

Canop 63 Dec 26, 2022
DexiosGUI - Simple cross-platform drag-and-drop Dexios file encryption

DexiosGUI Simple cross-platform drag-and-drop Dexios file encryption. Latest Windows x64 release is here. DexiosGUI is a Qt/C++ app for encrypt and de

Fabrice Corraire 4 Jul 25, 2022
A minimalistic cross-platform malware scanner with non-blocking realtime filesystem monitoring using YARA rules.

Sauron is a minimalistic, YARA based malware scanner with realtime filesystem monitoring written in Rust. Features Realtime scan of created and modifi

Simone Margaritelli 155 Dec 26, 2022
A simple to use, cross-platform aes encryption

About Project End to End encryption (AES) for multiple languages (cross-platform) with CBC Icon Item ?? Upcoming ⚖️ License ?? ChangeLog Usage (rust)

Zot Cryptography 2 Dec 15, 2022
A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords

password-generator-pro A fast, simple and powerful open-source cross platform utility tool for generating strong, unique and random passwords. Feature

Sebastien Rousseau 3 Dec 16, 2022
CLI password manager with encryption: AES256, Salsa20 and Chacha20, with cross platform and exclusive features

Keep My House (CLI) CLI password manager with encryption: AES256, Salsa20 and Chacha20, with cross platform and exclusive features Features AES256 GCM

null 4 Sep 7, 2023
A Peer-to-Peer cross-platform clipboard syncing tool.

p2p-clipboard p2p-clipboard is a Peer-to-Peer cross-platform clipboard syncing tool. It enables users to synchronize clipboard contents across multipl

null 3 Feb 28, 2024