# SbDraggableItem A wrapper component that makes its content draggable via HTML5 drag and drop. Used in visual builders for drag-and-drop interfaces. ## Parameters | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | Data | object? | null | Data to transfer during drag operation | | ItemType | string? | null | Type identifier for filtering drop targets | | Disabled | bool | false | Whether dragging is disabled | | Class | string? | null | Additional CSS classes | ## Events | Event | Type | Description | |-------|------|-------------| | OnDragStarted | EventCallback | Fired when drag begins | | OnDragEnded | EventCallback | Fired when drag ends | ## Templates / Slots | Slot | Type | Description | |------|------|-------------| | ChildContent | RenderFragment? | Content to make draggable | ## SbDragStartEventArgs Class | Property | Type | Description | |----------|------|-------------| | Data | object? | The data being dragged | | ItemType | string? | The item type identifier | ## CSS Classes - `sb-draggable-item` - Base class - `sb-draggable-item--dragging` - Applied during drag - `sb-draggable-item--disabled` - Disabled state ## Examples ### Basic Draggable Item ```razor
Drag me!
@code { private object item = new { Id = 1, Name = "Item 1" }; private void HandleDragStart(SbDragStartEventArgs args) { Console.WriteLine($"Dragging: {args.Data}"); } } ``` ### With Item Type ```razor
Widget
``` ### Palette of Draggable Components ```razor
@foreach (var component in availableComponents) {
@component.Name
}
@code { private List availableComponents = new() { new() { Type = "button", Name = "Button", Icon = "square" }, new() { Type = "text", Name = "Text", Icon = "type" }, new() { Type = "image", Name = "Image", Icon = "image" } }; private ComponentInfo? draggedComponent; private void HandleDragStart(SbDragStartEventArgs args) { draggedComponent = args.Data as ComponentInfo; } private void HandleDragEnd() { draggedComponent = null; } } ``` ### Disabled State ```razor
@if (isLocked) { } Item Content
``` ### Combined with SbDropZone ```razor
Text Block
Image Block
@foreach (var block in pageBlocks) {
@block.Name
}
```