Skip to main content
Question

Content Picker questions

  • May 22, 2025
  • 6 replies
  • 31 views

Forum|alt.badge.img

Hi,

I have a couple questions.

1. Is there a way to show the content picker in a modal window via javascript? I see that you can make it show a button to open a modal window, but what if I want to skip the button step entirely?

2. Is there a mode that allows selection of both files and folders?

Thanks in advance,

Jamie

6 replies

Forum|alt.badge.img

1. That is something you will have to implement yourself. You can do something like

window.open('https://codepen.io/box-platform/live/PWPxBm', 'sdfsdf', "width=800,height=600')

However you will have to also write some code to pass data from the modal to the parent window via postMessage (https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) or window.opener (https://developer.mozilla.org/en-US/docs/Web/API/Window/opener) or some other mechanism, so that what the content picker chooses, gets sent back to your code that opened the popup.

 

2. Use ContentPicker parent class instead of FolderPicker or FilePicker. It accepts a type option which can be 'file,folder,web_link'

var contentPicker = new Box.ContentPicker();
contentPicker.show(folderId, accessToken, { type: 'file,folder,web_link' });

 


Forum|alt.badge.img

Thank you so much, that's really helpful. Is there anywhere that describes the ContentPicker class a bit more?


Forum|alt.badge.img

Hi  and 

 

Have you checked out this article here?

https://developer.box.com/v2.0/docs/box-content-picker


Forum|alt.badge.img

Hi Howard,

Thanks for the response!

Yes, I've read through there. All the examples are split into file/folder so it's a little unclear what's part of the Content picker parent class and what's individual to files/folders.

 

Best,

Jamie


Forum|alt.badge.img

FilePicker is the same as ContentPicker with type='file' hardcoded.

FolderPicker is the same as ContentPicker with type='folder' hardcoded.

And in ContentPicker you can just specify the type you want, comma separated list.

I probably should add it to the documentation.


Forum|alt.badge.img

Great, that's really helpful. Thanks!