MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Draggable

Function Draggable

packages/@react-spectrum/s2/stories/DropZone.stories.tsx:157–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155};
156
157function Draggable() {
158 let {dragProps} = useDrag({
159 getItems() {
160 return [
161 {
162 'text/plain': 'hello world'
163 }
164 ];
165 },
166 getAllowedDropOperations() {
167 return ['copy'];
168 }
169 });
170
171 let {clipboardProps} = useClipboard({
172 getItems() {
173 return [
174 {
175 'text/plain': 'hello world'
176 }
177 ];
178 }
179 });
180
181 let ref = React.useRef(null);
182 let {buttonProps} = useButton({elementType: 'div'}, ref);
183
184 return (
185 <FocusRing>
186 <div
187 className={style({color: 'gray-900'})}
188 ref={ref}
189 {...mergeProps(dragProps, buttonProps, clipboardProps)}>
190 <span>Drag me</span>
191 </div>
192 </FocusRing>
193 );
194}

Callers

nothing calls this directly

Calls 4

useDragFunction · 0.90
useClipboardFunction · 0.90
useButtonFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected