Skip to content

View

A general-purpose retained container for layout, paint, pointer input, and accessibility.

Loading interactive demo…

#Import

Import div from quickgui.

use quickgui::*;

#Usage

div()
    .p(20.0)
    .gap(12.0)
    .child(text("Hello from Rust"))
    .child(button().on_click(continue_clicked).child("Continue"))

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

pub fn div() -> Element

Create a container element.

bgpub fn bg(mut self, color: Color) -> Self—

Configures bg for this part.

pub fn bg(mut self, color: Color) -> Self
View source
pxpub fn px(mut self, value: f32) -> Self—

Configures px for this part.

pub fn px(mut self, value: f32) -> Self
View source
hoverpub fn hover(mut self, style: impl FnOnce(ElementStateStyle) -> ElementStateStyle) -> Self—

Configures hover for this part.

pub fn hover(mut self, style: impl FnOnce(ElementStateStyle) -> ElementStateStyle) -> Self
View source
childpub fn child(mut self, child: impl IntoElement) -> Self—

Configures child for this part.

pub fn child(mut self, child: impl IntoElement) -> Self
View source
on_clickpub fn on_click<V>(mut self, listener: crate::ClickListener<V>) -> Self—

Attach a listener registered by [`crate::ViewContext::listener`].

pub fn on_click<V>(mut self, listener: crate::ClickListener<V>) -> Self
View source
idpub fn id(mut self, id: impl Into<ElementId>) -> Self—

Configures id for this part.

pub fn id(mut self, id: impl Into<ElementId>) -> Self
View source