# Freya

> Freya is a cross-platform and non-web GUI library for Rust powered by Skia.

Important notes:
- Freya 0.4+ uses its own reactive core, no longer based on Dioxus
- Cross-platform support for Windows, Linux, and macOS
- Built-in component library with testing, animations, and accessibility

## Features

- **Component Model**: Separate UI pieces by turning them into reusable components that. Each component takes some **Input**, might manage some inner **State** and ultimately returns a **UI**.
- **Headless Testing**: Easily test your UI logic in a headless environment, supports all the normal features. In fact most of the internal components and features are tested with it.
- **i18n (Language Translation)**: Easily translate your apps with `freya-i18` using the Fluent language.
- **Shaders**: Render from simple to complex shaders using the Skia Shaders language (SlSl).
- **a11y (Accessibility)**: You can make your UI elements accessible by using the a11y attributes.
- **Built-in Components**: Freya comes with a set of ready-to-use components, these include ScrollViews, VirtualScrollViews, Buttons, Switch, Slider, etc.
- **Animations**: Easily animate your UI whether its a size or a color. You have full control over its behavior.
- **Text Editing**: Freya supports from simple to rich text editing. You can even make cloned editors, virtualized editors, etc.
- **Code Editor**: A dedicated code editor component available in `freya-code-editor`.
- **Markdown**: Render Markdown documents with the `MarkdownViewer` component available in `freya-markdown`.
- **Cross-platform**: Your app will render and behave the same in Windows, Linux and MacOS.
- **Efficient Global State**: Efficiently manage a global state based on topics subscription using `freya-radio`.
- **Icons**: Easily add icons to your app using `freya-icons`, currently only supports Lucide.
- **Devtools**: Inspect your app UI tree to to debug, or see performance state.
- **Routing**: Manage your app UI in separate routes using `freya-router`.
- **WebView**: Integrate WebViews into your application using `freya-webview`.
- **Terminal**: Integrate terminal emulators into your application using `freya-terminal`.
- **Video**: Play videos with audio using `freya-video`.
- **Camera**: Capture webcam frames in your application using `freya-camera`.

## Example: Counter

```rust
fn app() -> impl IntoElement {
    let mut count = use_state(|| 4);

    let counter = rect()
        .width(Size::fill())
        .height(Size::percent(50.))
        .center()
        .color((255, 255, 255))
        .background((15, 163, 242))
        .font_weight(FontWeight::BOLD)
        .font_size(75.)
        .shadow((0., 4., 20., 4., (0, 0, 0, 80)))
        .child(count.read().to_string());

    let actions = rect()
        .horizontal()
        .width(Size::fill())
        .height(Size::percent(50.))
        .center()
        .spacing(8.0)
        .child(
            Button::new()
                .on_press(move |_| {
                    *count.write() += 1;
                })
                .child("Increase"),
        )
        .child(
            Button::new()
                .on_press(move |_| {
                    *count.write() -= 1;
                })
                .child("Decrease"),
        );

    rect().child(counter).child(actions)
}
```

## Docs

- [Stable Documentation](https://docs.rs/freya/): Official Rust API documentation
- [Development Setup](https://docs.rs/freya/latest/freya/_docs/development_setup/index.html): Getting started guide

## Release Candidate docs
- [UI and Components](https://docs.rs/freya/0.4.0/freya/_docs/ui_and_components/index.html): UI patterns and components guide
- [Elements](https://docs.rs/freya/0.4.0/freya/elements/index.html): Core UI elements reference
- [Events](https://docs.rs/freya/0.4.0/freya/_docs/events/index.html): Event handling, propagation, and prevent_default
- [Hooks](https://docs.rs/freya/0.4.0/freya/_docs/hooks/index.html): Hooks reference
- [State Management](https://docs.rs/freya/0.4.0/freya/_docs/state_management/index.html): State management guide
- [Development Setup](https://docs.rs/freya/0.4.0/freya/_docs/development_setup/index.html): Getting started guide
- [Built-in Components](https://docs.rs/freya/0.4.0/freya/components/index.html): Available components
- [Built-in Components Gallery](https://docs.rs/freya/0.4.0/freya/components/gallery/index.html): Component examples
- [i18n](https://docs.rs/freya-i18n/0.4.0/freya_i18n/): Internationalization support
- [Animation](https://docs.rs/freya-animation/0.4.0/freya_animation/): Animation utilities
- [Routing](https://docs.rs/freya-router/0.4.0/freya_router/): Navigation routing
- [Clipboard](https://docs.rs/freya-clipboard/0.4.0/freya_clipboard/): Clipboard operations
- [Icons](https://docs.rs/freya-icons/0.4.0/freya_icons/): Icon library
- [Material Design](https://docs.rs/freya-material-design/0.4.0/freya_material_design/): Material Design components
- [Plotters](https://docs.rs/freya-plotters-backend/0.4.0/freya_plotters_backend/): Plotting backend
- [Testing](https://docs.rs/freya-testing/0.4.0/freya_testing/): Testing framework
- [Terminal](https://docs.rs/freya-terminal/0.4.0/freya_terminal/): Terminal emulator integration
- [Code Editor](https://docs.rs/freya-code-editor/0.4.0/freya_code_editor/): Code editor component
- [Video](https://docs.rs/freya-video/0.4.0/freya_video/): Video playback with audio
- [Markdown](https://docs.rs/freya-markdown/0.4.0/freya_markdown/): Markdown rendering component
- [Camera](https://docs.rs/freya-camera/0.4.0/freya_camera/): Camera capture integration

## Examples

- [Counter Example](https://github.com/marc2332/freya/blob/main/examples/counter.rs): Basic counter with state management
- [All Examples](https://github.com/marc2332/freya/tree/main/examples): Complete collection of examples including components, animations, layouts, and more
- [Freya Template](https://github.com/marc2332/freya-template): Starter template for new projects

## Community

- [Website](https://freyaui.dev): Official website with tutorials and guides
- [Discord Server](https://discord.gg/sYejxCdewG): Community chat and support

## Optional

- [Contributing Guide](https://github.com/marc2332/freya/blob/main/CONTRIBUTING.md): Guidelines for contributors
- [GitHub Repository](https://github.com/marc2332/freya): Source code and issues
