Crate tessera_ui_basic_components

Crate tessera_ui_basic_components 

Source
Expand description

Basic components for the Tessera UI framework.

§Usage

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

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

Renderer::run(
    // ...
    |app| {
        tessera_ui_basic_components::pipelines::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 = RippleState::new();
button(
    ButtonArgs {
        on_click: Some(Arc::new(|| { /* Handle click */ })),
        ..Default::default()
    },
    ripple_state.clone(),
    || text("Click me".to_string()),
);

// Text editor example
let editor_state = 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.
bottom_sheet
A component that displays content sliding up from the bottom of the screen.
boxed
A container for stacking and aligning multiple children.
button
An interactive button component.
button_groups
Material 3-style segmented buttons with single or multiple selection.
checkbox
A customizable, animated checkbox component.
column
A vertical layout component.
dialog
Modal dialog provider — show modal content above the main app UI.
fluid_glass
A component for creating a frosted/distorted glass visual effect.
glass_button
An interactive button with a glassmorphic background.
glass_progress
A progress bar with a glassmorphic visual style.
glass_slider
A slider component with a glassmorphic visual style.
glass_switch
A switch (toggle) component with a glassmorphic visual style.
icon
A component for rendering raster or vector icons.
icon_button
An interactive button that displays an icon.
image
A component for rendering raster images.
image_vector
Vector image component built on top of SVG parsing and tessellation.
lazy_list
Virtualized list components for displaying long scrolling feeds.
material_color
Material Design color utilities for HCT and dynamic scheme generation.
material_icons
Material Design icon content helpers.
menus
Material Design 3 menus for contextual action lists.
navigation_bar
Material Design 3 navigation bar for primary app destinations.
pipelines
Render and compute pipelines backing the basic components.
pos_misc
Convenience utilities for testing whether a cursor/point falls inside a component or a rectangle. Functions operate using Px units and simple inclusive comparisons on edges.
progress
A linear progress bar component.
radio_button
Material Design 3 radio button with animated selection feedback.
ripple_state
Ripple state — manage ripple animation and hover state for interactive components.
row
A horizontal layout component.
scrollable
A container that allows its content to be scrolled.
shape_def
Defines the Shape enum and its variants, used for describing the geometric form of UI components.
side_bar
A component that displays a side bar sliding in from the left.
slider
An interactive slider component for selecting a value in a range.
spacer
An invisible component for creating empty space in a layout.
surface
A flexible container component with styling and interaction options.
switch
An interactive toggle switch component.
tabs
A component for creating a tab-based layout.
text
A component for rendering single-style text.
text_editor
A multi-line text editor component.

Structs§

RippleProps
Properties for ripple effect animation
ShadowProps
Properties for shadow, used in BasicDrawable variants