Skip to main content

Option for tag1 AND tag2 AND tag3 in Media Library Widget?



  • Tia Esguerra

    Hi Ada,

    Thanks so much for reaching out. 

    Yes, this is possible. When you call the openMediaLibrary method or the createMediaLibrary method, you pass in some configuration options. One of the custom options available to the show method is search. So if you pass a search expression, the media library widget will be opened with the search results filtered according to your search expression. 

    Based on your specification of searching for assets that have the tags 'size-8', 'leather', and 'loafers', this is how that should be passed as part of the configuration options:


    search: {

    expression:"tags=size-8 AND tags=leather AND tags=loafers",


    You can reference that documentation on the configuration options available to you here: 

    I hope this helps. Please let me know if you have any questions. 

    Kind Regards, 


  • Ada Diamonds


    Thank you for the helpful response!  To make sure I understand you correctly, we could add our own UX as a wrapper outside of the widget and call show() with new search expressions when the client changes an option in our UX? That would be a great solution for us, assuming it's performant enough.

    1. Does show() reload the entire widget, or just update the options in the existing widget?
    2. Do we need to hide() then show(), or can we just call show() to refresh the widget?

    IE if the user changed from 'size-8' to 'size-10' and 'loafers' to 'monkstraps' we would just need to call show() with:

    search: {

    expression:"tags=size-10 AND tags=leather AND tags=monkstraps",

    }, [options) - If you want to adjust any of the Media Library behavior options that were defined when you instantiated the widget, you can optionally pass a new options object with the settings you want to change for this particular show session.

  • Tamara Yulevich

    Hi Ada, 

    Sorry for the late response, let me help while Tia is offline. 

    1. Yes, show() updates the widget with the adjusted options.

    2. Yes exactly - when you hide the widget, any adjusted options that were passed in the show() command are forgotten, and the settings revert to those set in the initial instantiation. In order to refresh with new adjusted options, please call hide() and then show().

    Hope this helps, let me know if you have any further questions, 

    Best regards, 


  • Ada Diamonds

    Thank you Tamara - much appreciated. We'll do some performance testing and see if this strategy works well for us.


Post is closed for comments.