# Overview

[**Floem**](https://lap.dev/floem/) is a cross-platform GUI library for Rust. It aims to be extremely performant while providing world-class developer ergonomics.

Supporting both GPU and CPU rendering, Floem gives you performance that's closest to bare metal. Also primitives are provided to help the developer to write performant UI code without too much effect.

<figure><img src="https://acdb0343.lapdev-website.pages.dev/images/counter.png" alt=""><figcaption></figcaption></figure>

```rust
use floem::{
    reactive::create_signal,
    views::{button, label, Decorators},
    IntoView,
};

fn app_view() -> impl IntoView {
    // Create a reactive signal with a counter value, defaulting to 0
    let (counter, mut set_counter) = create_signal(0);

    // Create a vertical layout
    (
        // The counter value updates automatically, thanks to reactivity
        label(move || format!("Value: {counter}")),
        // Create a horizontal layout
        (
            button("Increment").action(move || set_counter += 1),
            button("Decrement").action(move || set_counter -= 1),
        ),
    ).style(|s| s.flex_col())
}

fn main() {
    floem::launch(app_view);
}
```

### Features

* **Cross-platform support**: Supports Windows, macOS and Linux with rendering using [wgpu](https://github.com/gfx-rs/wgpu). In case a GPU is unavailable, a CPU renderer powered by [tiny-skia](https://github.com/RazrFalcon/tiny-skia) will be used.
* **Fine-grained reactivity**: The entire library is built around reactive primitives inspired by [leptos\_reactive](https://crates.io/crates/leptos_reactive). The reactive "signals" allow you to keep your UI up-to-date with minimal effort, all while maintaining very high performance.
* **Performance**: The view tree is only run once, safeguarding you from accidentally creating a bottleneck in a view generation function that slows down your entire application. Floem also provides tools to help you write efficient UI code, such as a [virtual list](https://github.com/lapce/floem/tree/main/examples/virtual_list).
* **Flexbox layout**: Using [Taffy](https://crates.io/crates/taffy), the library provides the Flexbox (or Grid) layout system, which can be applied to any View node.
* **Customisable widgets**: Don't want the default look? You can change pretty much anything you want using the styling API, or install a third-party theme.
* **Element inspector**: Inspired by your browser's developer tools, Floem provides a [diagnostic tool](https://docs.rs/floem/latest/floem/struct.ViewId.html#method.inspect) to debug your layout.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.floem.dev/introduction/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
