freya/_docs/
introduction.rs

1//! # Introduction
2//!
3//! **Freya** is a Rust 🦀 library to make GUI applications that are [**cross-platform**](https://en.wikipedia.org/wiki/Cross-platform_software), targeting Windows, macOS and Linux.
4//!
5//! Freya uses a [declarative](https://en.wikipedia.org/wiki/Declarative_programming) model for the UI, and components to encapculate the UI in reusable pieces of code.
6//!
7//! Freya renders using 🎨 [Skia](https://skia.org/) because its a very battle tested library and has great support for a lot of features.
8//!
9//! #### Example
10//!
11//! ```rust, no_run
12//! # use freya::prelude::*;
13//! fn main() {
14//!     // **Start** your app with a window and its root component
15//!     launch(LaunchConfig::new().with_window(WindowConfig::new(app)))
16//! }
17//!
18//! fn app() -> impl IntoElement {
19//!     // Define a **state**
20//!     let mut count = use_state(|| 0);
21//!
22//!     // Declare the **UI**
23//!     rect()
24//!         .width(Size::fill())
25//!         .height(Size::fill())
26//!         .background((35, 35, 35))
27//!         .color(Color::WHITE)
28//!         .padding(Gaps::new_all(12.))
29//!         .on_mouse_up(move |_| *count.write() += 1)
30//!         .child(format!("Click to increase -> {}", count.read()))
31//! }
32//! ```