ui icon indicating copy to clipboard operation
ui copied to clipboard

Drop zone component ?

Open vexkiddy opened this issue 1 year ago • 1 comments

Would it be possible to add a drop zone component ? Thanks for the amazing work!! :D

vexkiddy avatar Feb 05 '24 06:02 vexkiddy

There's already an issue here: https://github.com/shadcn-ui/ui/issues/163

cpeaustriajc avatar Feb 07 '24 14:02 cpeaustriajc

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Mar 01 '24 23:03 shadcn

I still want this.

beachstrider avatar Jun 12 '24 19:06 beachstrider

I created a simple version of the drop-zone component, published as shadcn-dropzone. ✨

yarn add shadcn-dropzone

Here is an example of how you would use it:

<Dropzone
  onDrop={(acceptedFiles: File) => {
    // Do something with the files
  }}
>
  {(dropzone: DropzoneState) => (
    <>
      {
        dropzone.isDragAccept ? (
          <div className='text-sm font-medium'>Drop your files here!</div>
        ) : (
          <div className='flex items-center flex-col gap-1.5'>
            <div className='flex items-center flex-row gap-0.5 text-sm font-medium'>
              Upload files
            </div>
          </div>
        )
      }
      <div className='text-xs text-gray-400 font-medium'>
        { dropzone.acceptedFiles.length } files uploaded so far.
      </div>
    </>
  )}
</Dropzone>

Demo: https://diragb.github.io/shadcn-dropzone

diragb avatar Jul 09 '24 20:07 diragb

@diragb the demo site is down

ArielMejiaDev avatar Jul 09 '24 23:07 ArielMejiaDev

@diragb the demo site is down

Thanks for this, it's up now.

diragb avatar Jul 10 '24 04:07 diragb

is there any chance this might become part of the official shadcn repo ? @shadcn ? :)

vexkiddy avatar Jul 10 '24 17:07 vexkiddy