pub struct SortableListProps {
pub len: usize,
pub render: Callback<usize, Element>,
pub on_sort: EventHandler<SortEvent>,
pub axis: Axis,
pub live_preview: bool,
pub transition_ms: u32,
pub overlay: Option<Callback<usize, Element>>,
pub touch_handle: bool,
pub touch: TouchSense,
pub handle: Option<Callback<usize, Element>>,
pub item_key: Option<Callback<usize, String>>,
pub attributes: Vec<Attribute>,
}Expand description
Properties for the SortableList component.
Fields§
§len: usizeNumber of items.
render: Callback<usize, Element>Renders the item at the given index.
on_sort: EventHandler<SortEvent>Fired when the user drops an item at a new position.
axis: AxisList direction: which axis rows are laid out (and shifted) along.
live_preview: boolOpen a live gap where the drop would land, by translating the rows
in between. Set false for the plain highlight-only behavior.
transition_ms: u32Duration (ms) of the row-slide transition during live preview.
overlay: Option<Callback<usize, Element>>Opt-in floating ghost: renders overlay(index) pinned to the pointer
while dragging, and hides the picked-up row in place so its slot reads
as the drop gap. Absent → the row itself slides. Keep the ghost
lightweight; it is your content, not a clone of the row.
touch_handle: boolConfine touch/pen drags to a leading grip element instead of the
whole row. The grip carries touch-action: none so the rest of the
row keeps scrolling by finger - use this inside scrollable lists.
Style it via [data-sort-handle].
touch: TouchSenseHow a finger shares whole rows with native scrolling (ignored under
touch_handle, where the grip owns every touch).
TouchSense::Auto (default) keeps vertical swipes scrolling and
picks a row up on a short hold or a sideways pull;
TouchSense::Immediate makes any 8px travel drag.
handle: Option<Callback<usize, Element>>Content for the touch_handle grip, keyed by index. Defaults to a
braille-dots glyph when unset.
item_key: Option<Callback<usize, String>>Stable render identity for each item. Supply this whenever rows own hook state or focus and the backing collection can reorder.
attributes: Vec<Attribute>Implementations§
Source§impl SortableListProps
impl SortableListProps
Sourcepub fn builder() -> SortableListPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> SortableListPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building SortableListProps.
On the builder, call .len(...), .render(...), .on_sort(...), .axis(...)(optional), .live_preview(...)(optional), .transition_ms(...)(optional), .overlay(...)(optional), .touch_handle(...)(optional), .touch(...)(optional), .handle(...)(optional), .item_key(...)(optional), .attributes(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of SortableListProps.
Trait Implementations§
Source§impl Clone for SortableListProps
impl Clone for SortableListProps
Source§impl PartialEq for SortableListProps
impl PartialEq for SortableListProps
Source§impl Properties for SortableListPropswhere
Self: Clone,
impl Properties for SortableListPropswhere
Self: Clone,
Source§type Builder = SortableListPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
type Builder = SortableListPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
Source§fn memoize(&mut self, new: &Self) -> bool
fn memoize(&mut self, new: &Self) -> bool
Source§fn into_vcomponent<M>(
self,
render_fn: impl ComponentFunction<Self, M>,
) -> VComponentwhere
M: 'static,
fn into_vcomponent<M>(
self,
render_fn: impl ComponentFunction<Self, M>,
) -> VComponentwhere
M: 'static,
Auto Trait Implementations§
impl !RefUnwindSafe for SortableListProps
impl !Send for SortableListProps
impl !Sync for SortableListProps
impl !UnwindSafe for SortableListProps
impl Freeze for SortableListProps
impl Unpin for SortableListProps
impl UnsafeUnpin for SortableListProps
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DependencyElement for T
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more