Crate concoct

Source
Expand description

A UI framework for writing declarative apps on multiple platforms.

Concoct uses static typing to describe your UI at compile-time to create an efficient tree of components. Updates to state re-render your application top-down, starting at the state’s parent component.

use concoct::{View, ViewBuilder};
use concoct::hook::use_state;
use concoct_web::html;

struct App;

impl ViewBuilder for App {
    fn build(&self) -> impl View {
        let (count, set_high) = use_state(|| 0);
        let set_low = set_high.clone();

        (
            format!("High five count: {}", count),
            html::button("Up high!").on_click(move |_| set_high(count + 1)),
            html::button("Down low!").on_click(move |_| set_low(count - 1)),
        )
    }
}

§Feature flags

  • full: Enables all of the features below.
  • tracing: Enables logging with the tracing crate.

Re-exports§

pub use self::view::View;

Modules§

hook
Hooks to access render context.
view
Viewable components of a user-interface.

Structs§

TextViewContext
Provider for a platform-specific text view.
VirtualDom
A virtual dom that renders a view on any backend.

Traits§

Tree
Statically-typed view tree.
ViewBuilder
Builder for a View.

Functions§

run
Run a view in a new virtual dom.