Leptos-Use Guide

use_cycle_list

Cycle through a list of items.

Demo

Usage

use leptos::*;
use leptos::logging::log;
use leptos_use::{use_cycle_list, UseCycleListReturn};

#[component]
fn Demo() -> impl IntoView {
let UseCycleListReturn { state, next, prev, .. } = use_cycle_list(
    vec!["Dog", "Cat", "Lizard", "Shark", "Whale", "Dolphin", "Octopus", "Seal"]
);

log!("{}", state.get()); // "Dog"

prev();

log!("{}", state.get()); // "Seal"

view! { }
}

Feature

This function is only available if the crate feature use_cycle_list is enabled

Types

Source

SourceDemoDocs