Crate tessera_ui_basic_components

Source
Expand description

Basic UI components library for Tessera. Internal animation utilities are available via the private animation module. 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());

Re-exports§

pub use ripple_state::RippleState;

Modules§

alignment
Defines alignment options for layout components.
boxed
Provides the Boxed component for overlaying multiple child components in a single container.
button
Provides a highly customizable and interactive button component for Tessera UI.
checkbox
A customizable, animated checkbox UI component for Tessera UI.
checkmark
Provides a GPU-accelerated, animated checkmark component for UI elements.
column
Provides a flexible vertical layout component for arranging child widgets in a single column.
dialog
Provides a modal dialog component for overlaying content and intercepting user input.
fluid_glass
Fluid glass effect module for Tessera UI Basic Components.
glass_button
Provides an interactive button component with a glassmorphic (glass-like) background and ripple effect.
glass_dialog
Provides a modal glass dialog component for overlaying content and intercepting user input.
glass_slider
Provides a glassmorphism-style slider component for selecting a value in modern UI applications.
glass_switch
Glass Switch Component Module
image
This module provides the image component and related utilities for rendering images in Tessera UI.
padding_utils
pipelines
pos_misc
Contains some convenience functions for positioning and sizing.
progress
This module provides a customizable linear progress bar component for visualizing task completion.
ripple_state
row
Row Module
scrollable
Scrollable container component for Tessera UI.
selection_highlight_rect
Provides a rectangular highlight component for visually indicating selected regions, typically in text editors or similar UI elements. This module enables rendering of sharp-cornered, shadowless rectangles with configurable size and color, suitable for marking text selections or other highlighted areas. For multi-line or complex selections, multiple highlight rectangles can be composed to cover the desired region.
shape_def
Defines the basic shape types used by components.
slider
A reusable, interactive slider UI component for selecting a value within the range [0.0, 1.0].
spacer
Spacer component for Tessera UI.
surface
Provides a flexible, customizable surface container component for UI elements.
switch
Switch Component Module
text
Text component module for Tessera UI.
text_edit_core
Core module for text editing logic and state management in Tessera UI.
text_editor
Multi-line text editor component for the Tessera UI framework.

Macros§

boxed_ui
A macro for simplifying Boxed component declarations.
column_ui
A declarative macro to simplify the creation of a column component.
row_ui
A declarative macro to simplify the creation of a row component.