Crates.io | dioxus-slides |
lib.rs | dioxus-slides |
version | 0.1.2 |
source | src |
created_at | 2023-11-10 12:51:43.415159 |
updated_at | 2023-11-14 14:20:41.863668 |
description | A slides component library for dioxus |
homepage | |
repository | https://github.com/alexanderjophus/dioxus-slides |
max_upload_size | |
id | 1031092 |
size | 8,390 |
Dioxus Slides is a slides component library for Dioxus, a reactive UI library for Rust. It provides a way to create slide presentations using Dioxus and Rust.
next
and prev
methods provided by the Slidable
trait.render
method provided by the Slidable
trait.First, add dioxus-slides
to your Cargo.toml
:
[dependencies]
dioxus = "0.4.0"
dioxus-slides = "0.1"
Then, define your slides as an enum and derive the Slidable trait:
#![allow(non_snake_case)]
use dioxus::prelude::*;
use dioxus_slides::prelude::*;
#[derive(Slidable, Clone, Default)]
enum Slides {
#[default]
Intro,
Second,
Final,
}
Each variant of the enum represents a slide. You can then define a function for each slide that returns an Element:
fn Intro(cx: Scope) -> Element {
cx.render(rsx!(Slide::<Slides> {
content: render! {
div {
h1 { "Hello, world!" }
p { "This is the first slide." }
}
},
}))
}
// Define functions for the other slides...
Finally, you can use the SlideContainer component to render your slides:
fn app(cx: Scope) -> Element {
render! {
SlideContainer::<Slides>{
width: "100%",
height: "100%",
background_colour: "#eee",
show_slide_no: true,
}
}
}
License
This project is licensed under either of
Apache License, Version 2.0, LICENSE-APACHE MIT license at your option.
Please note that this README assumes that the LICENSE-APACHE
and LICENSE-MIT
files exist in the root directory of the project.