marc2332 / freya
git clone https://github.com/marc2332/freya.git
v0.4.3 · 1mo ago
Cross-platform native GUI library for 🦀 Rust
+15
stars, 24h · #2,414
+~40
stars, 7 days · #4,940
+~170
stars, 30 days · #4,546
3.2k
★ total · +1% this week
149
forks · 44 open issues
Star history (as recorded here)
LanguageRust
LicenseMIT
Created2022-07-27 (4y ago)
Last pushtoday
Watchers18
OwnerUser
GitHub topics
Links
- GitHub: github.com/marc2332/freya
- Homepage: https://freyaui.dev
- Releases · Issues · Hacker News mentions
README excerpt
# Freya 🦀 Website | Documentation | Discord | Contact **Freya** is a **cross-platform, native, declarative** GUI library for Rust 🦀. ### Usage 📜 Latest stable release: [code] Next release: [code] `main` branch: [code] ### Trying it out 🚀 Make sure to have Development Setup ready. > ⚠️ **This repo uses git submodules**, cloning without `--recurse-submodules` will make the examples fail to compile. [code] > **Already cloned without submodules?** Run `git submodule update --init --recursive` to fetch them. Then run an example: [code] > ⚠️ If you happen to be on Windows using `windows-gnu` and get compile errors, maybe go check this issue. ### Components & State Freya’s component model lets you create reusable UI elements that automatically re-render when the state they depend on changes. Components can hold their own internal state or subscribe to shared state, and they produce UI as their output. Any type that implements the `Component` trait can be a component, while the root (`app`) component can simply be a function. Built-in examples include components like `Button` and `Switch`. [code] ### Out of the box components Freya comes with a set of components out of the box, from simple like `Button`, `Switch`, `Slider` to more complex like `VirtualScrollView`, `Calendar`, `ColorPicker`, etc. You can check all the examples that start with `component_` in the examples folder. Example of `component_input.rs`: ### Smooth Animations Create transitions for colors, sizes, positions, and other visual properties. The animation API gives you full control over timing, easing functions, and animation sequences. Code [code] Portal example Component Portal ### Rich Text Editing Freya provides text editing capabilities that go beyond simple input fields. You can create rich text editors with cursor management, text selection, keyboard shortcuts, custom formatting, virtulization and more. Code [code] ### Code Editor Create and control text Code Editors. It is state agnostic so as long as it can be turned into a `Writable` it will work. Uses Rope for text editing and tree-sitter for syntax highlighting. You bring your own tree-sitter grammar and its highlights query, so any language can be supported. Enable with the `code-editor` feature. Code [code] ### Markdown Render Markdown documents with the `MarkdownViewer` component. Enable with the `markdown` feature. Code [code] ### Routing & Navigation Define routes, manage navigation state, and transition between different views. Enable with the `router` feature. Code [code] ### Global State Management Freya's `freya-radio` state management system provides efficient global state management through a channels system. Components subscribe to specific "channels" and only receive updates when data is mutated and notified through their channel. Enable with the `radio` feature. Code [code] ### Icon Library Easily integrate icons into your applications, only supports Lucide at the moment. Co