Method Draggable
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Draggable(string, object?, bool, DragMovement, DragActivation?, string?, string?, string?, string?, FiberElementProps?, StyleOverrides?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)
Drag source. The element itself is the drag node; it must sit (at any depth) under a DndContext(Action<DragStartArgs>?, Action<DragOverArgs>?, Action<DragEndArgs>?, Action<DragCancelArgs>?, DndCollisionDetection?, DragActivation?, string?, string?, string?, FiberElementProps?, StyleOverrides?, Func<VisualElement, Action>?, VNode?[]?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?) scope.
public static ElementNode Draggable(string id, object? dragData = null, bool disabled = false, DragMovement movement = DragMovement.Translate, DragActivation? activation = null, string? whileDraggingClass = null, string? className = null, string? key = null, string? name = null, FiberElementProps? props = null, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, VNode?[]? children = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null)
Parameters
idstringIdentity reported to the scope callbacks. An element that is both draggable and droppable under one id never collides with itself.
dragDataobjectArbitrary payload carried into the callbacks.
disabledboolA disabled draggable never arms.
movementDragMovementTranslate (default) writes the pointer delta as an inline translate during the drag; None leaves the source in place (the V.DragOverlay ghost pattern).
activationDragActivationPer-draggable activation constraint; wins over the scope's.
whileDraggingClassstringClasses applied while this element's drag is active — the zero-re-render isDragging channel.
classNamestringkeystringnamestringpropsFiberElementPropsstylesStyleOverridesrefCallbackFunc<VisualElement, Action>childrenVNode[]whileHoverClassstringwhileTapClassstringwhileFocusClassstringdataIReadOnlyDictionary<string, string>ariaIReadOnlyDictionary<string, string>
Returns
- ElementNode
The created ElementNode.
Exceptions
- ArgumentOutOfRangeException
movementnames no member of DragMovement.