tessera-ui-basic-components 1.0.0

Basic components for tessera-ui
Documentation

Basic components for the Tessera UI framework.

Usage

First, you need to register the pipelines provided by this crate.

use tessera_ui::renderer::WgpuApp;
use tessera_ui_basic_components::pipelines::register_pipelines;

fn setup(app: &mut WgpuApp) {
    register_pipelines(app);
}

Then you can use the components in your UI.

Example

use std::sync::Arc;
use parking_lot::RwLock;

use tessera_ui::Dp;
use tessera_ui_basic_components::{
    button::{button, ButtonArgs},
    text::text,
    text_editor::{text_editor, TextEditorArgs, TextEditorState},
    RippleState,
};

// Button example
let ripple_state = Arc::new(RippleState::new());
button(
    ButtonArgs {
        on_click: Arc::new(|| { /* Handle click */ }),
        ..Default::default()
    },
    ripple_state,
    || text("Click me".to_string()),
);

// Text editor example
let editor_state = Arc::new(RwLock::new(TextEditorState::new(Dp(16.0), None)));
text_editor(TextEditorArgs::default(), editor_state.clone());