From 077000ed66a145b9aaf21c388689c6e1cfdf326c Mon Sep 17 00:00:00 2001 From: spushk Date: Sun, 11 Oct 2026 23:44:37 +0300 Subject: [PATCH] doc: minimal doc for Sortable + pub styles --- src/lib.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 01e8a82..6596576 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,6 +29,50 @@ pub fn Styles() -> impl IntoView { view! { } } +/// Display drag-sortable sequence. +/// +/// Drag-n-drop implementation relies on CSS classes, so make sure to include `` +/// somewhere in your page's markup +/// +/// ## Examples +/// +/// **Default drag handle and gap** +/// +/// ``` +/// # use leptos::prelude::*; +/// # #[component] +/// # fn Example() -> impl IntoView { +/// # use leptos_sp_sortable::{Sortable, Item}; +/// # let data = RwSignal::new(vec![Item::new(0)]); +/// view!{ +/// {i.into_inner()}}} +/// /> +/// } +/// # } +/// ``` +/// +/// **Custom drag handle and gap** +/// +/// ``` +/// # use leptos::prelude::*; +/// # #[component] +/// # fn Example() -> impl IntoView { +/// # use leptos_sp_sortable::{Sortable, Item}; +/// # let data = RwSignal::new(vec![Item::new(0)]); +/// view!{ +/// {i.into_inner()}}} +/// gap={move |h: Signal| { +/// view!{
+/// }}} +/// handle={move || view!{"🤟"}} +/// /> +/// } +/// # } +/// ``` #[component] pub fn Sortable( data: T, @@ -106,7 +150,6 @@ where on_cleanup(|| set_dragging_cursor(false)); view! { class=SORTABLE, -