Skip to main content

Crate freya

Crate freya 

Source
Expand description

§Freya

Freya is a declarative, cross-platform GUI 🦀 Rust library, powered by 🎨 Skia.

§Example
fn main() {
    // *Start* your app with a window and its root component
    launch(LaunchConfig::new().with_window(WindowConfig::new(app)))
}

fn app() -> impl IntoElement {
    // Define a reactive *state*
    let mut count = use_state(|| 0);

    // Declare the *UI*
    rect()
        .width(Size::fill())
        .height(Size::fill())
        .background((35, 35, 35))
        .color(Color::WHITE)
        .padding(Gaps::new_all(12.))
        .on_mouse_up(move |_| *count.write() += 1)
        .child(format!("Click to increase -> {}", count.read()))
}

§Basics

§Learn

§Features flags

§Misc features

  • devtools: Enables devtools support.
  • performance: Reexports the performance overlay plugin. The plugin is auto-added in debug builds.
  • vulkan: Enables Vulkan rendering support.
  • hotpath: Enables Freya’s internal usage of hotpath.
  • hotreload: Enables hot reload support via the dx CLI from dioxus-cli. See Hot Reload.
  • zoom-shortcuts: Enables Ctrl/Cmd + +/-/0 to zoom the app.

Modules§

_docs
Freya guides.
animation
Reexport freya-animation.
cameracamera
Reexport freya-camera when the camera feature is enabled.
clipboard
Reexport freya-clipboard.
code_editorcode-editor
Reexport freya-code-editor when the code-editor feature is enabled.
components
Built-in components like Button, Input or ScrollView.
elements
Built-in elements like rect, label or paragraph.
engineengine
Reexport freya-engine when the engine feature is enabled.
helpers
Helpers to build elements out of plain functions.
i18ni18n
Reexport freya-i18n when the i18n feature is enabled.
iconsicons
Reexport freya-icons when the icons feature is enabled.
markdownmarkdown
Reexport freya-markdown when the markdown feature is enabled.
material_designmaterial-design
Reexport freya-material-design when the material-design feature is enabled.
performanceperformance
Reexport freya-performance-plugin when the performance feature is enabled.
plotplot
Reexport freya-plotters-backend and plotters when the plot feature is enabled.
prelude
Common imports to build Freya apps, use it with use freya::prelude::*;.
queryquery
Reexport freya-query when the query feature is enabled.
radioradio
Reexport freya-radio when the radio feature is enabled.
routerrouter
Reexport freya-router when the router feature is enabled.
sdksdk
Reexport freya-sdk when the sdk feature is enabled.
terminalterminal
Reexport freya-terminal when the terminal feature is enabled.
text_edit
Reexport freya-edit, the text editing APIs.
traytray
Reexport tray-icon when the tray feature is enabled.
videovideo
Reexport freya-video when the video feature is enabled.
webviewwebview
Reexport freya-webview when the webview feature is enabled.
winitwinit
Reexport winit when the winit feature is enabled.