1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
//! # Elements
//!
//! This is an overview of the elements supported in Freya.
//!
//! > For more info check the [API Reference](freya_elements::elements#structs).
//!
//! ### `rect`
//!
//! [`rect`](freya_elements::elements::rect) is a generic element that acts as a container for other elements.
//!
//! You can specify things like **width**, **padding** or even in what **direction** the inner elements are stacked.
//!
//! Example:
//!
//! ```rust
//! # use freya::prelude::*;
//! fn app() -> Element {
//! rsx!(
//! rect {
//! direction: "vertical",
//! label { "Hi!" }
//! }
//! )
//! }
//! ```
//!
//! ### `label`
//!
//! [`label`](freya_elements::elements::label) simply let's you display some text.
//!
//! Example:
//!
//! ```rust
//! # use freya::prelude::*;
//! fn app() -> Element {
//! rsx!(
//! label {
//! "Hello World"
//! }
//! )
//! }
//! ```
//!
//! ### `paragraph`
//!
//! [`paragraph`](freya_elements::elements::paragraph) element let's you build texts with different styles.
//!
//! This used used with the `text` element.
//!
//! Example:
//!
//! ```rust
//! # use freya::prelude::*;
//! fn app() -> Element {
//! rsx!(
//! paragraph {
//! text {
//! font_size: "15",
//! "Hello, "
//! }
//! text {
//! font_size: "30",
//! "World!"
//! }
//! }
//! )
//! }
//! ```
//!
//! ### `image`
//!
//! [`image`](freya_elements::elements::image) element let's you show an image.
//!
//! Example:
//!
//! ```rust
//! # use freya::prelude::*;
//! static RUST_LOGO: &[u8] = include_bytes!("./rust_logo.png");
//!
//! fn app() -> Element {
//! let image_data = static_bytes(RUST_LOGO);
//! rsx!(image {
//! image_data: image_data,
//! width: "100%",
//! height: "100%",
//! })
//! }
//! ```
//!
//! ### `svg`
//!
//! [`svg`](freya_elements::elements::svg) element let's you display an SVG.
//!
//! Example:
//!
//! ```rust
//! # use freya::prelude::*;
//! static FERRIS: &[u8] = include_bytes!("./ferris.svg");
//!
//! fn app() -> Element {
//! let ferris = static_bytes(FERRIS);
//! rsx!(svg {
//! svg_data: ferris,
//! width: "100%",
//! height: "100%",
//! })
//! }
//! ```