Bynder UI components

Bynder UI components to support frontend developers on building their web applications.

Compact View

See Compact View in action

The Bynder Compact View is the easiest way to get assets from Bynder into your web application. It's a component written in ReasonML powered by an OCaml backend that allows developers to add support for selecting and importing assets from a Bynder Asset Bank without having to worry about the intricacies related to building a file picker: UI design, authentication, API requests, etc. This component fetches the assets and their metadata through the Bynder API and renders it by replicating Bynder look & feel. Users can query, filter (by smartfilters, metaproperties, tags, keyword, and existing collections), sort, and select assets to then import them into another application.

Compact View works with all methods of authentication that your Bynder portal supports.

Compact View on Bynder Knowledge Base

Screenshots

How it works

To setup the Bynder Compact View in your web app, add the following line to your page:

<script src="https://d8ejoa1fys2rk.cloudfront.net/5.0.5/modules/compactview/bynder-compactview-2-latest.js"></script>

After it you can trigger/configure the Compact View through its new API:

BynderCompactView.open({ onSuccess: function (assets) { /* Do something with given asset array */ }, defaultDomain: "example.bynder.com", /* ... other options ... */ })

The optional options object accepts the following attributes (which are also all optional):

AttributeDescriptionPossible ValuesDefault Value
onSuccessComma separated list of asset types to displayfunction (assets: array(asset)): voidconsole.log
containerA DOM element to act as the container for Compact View (disables modal)Dom.HTMLElement instanceNone
defaultDomainSet a default portal URL for the Compact View login screenA string containing Bynder portal URLNone
defaultSearchTermSet the initial value for search term"Keyword" None
languageSet language for the Compact View"en_US", "nl_NL", "de_DE", "fr_FR", "es_ES""en_US"
modeSet the Compact View to allow multiple or single asset selection"SingleSelect" or "MultiSelect""false"
themeA theme object for customizing Compact View look and feelObject (see below for recognized keys)None
assetTypesAn array of strings for limiting allowed asset typesimage, video, document, audio["image", "audio", "video", "document"]

Recognized keys for theme:

type theme = { colorPrimary?: CSSColor; colorButtonPrimary?: CSSColor; colorButtonPrimaryLabel?: CSSColor; colorButtonPrimaryActive?: CSSColor; colorButtonPrimaryHover?: CSSColor; colorButtonPrimaryHoverLabel?: CSSColor; };

Example usage

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Bynder Compact View</title>
    <link href=data:, rel=icon>
  </head>
  <body>
    <div id="importedAssets"></div>
    <script src="https://d8ejoa1fys2rk.cloudfront.net/5.0.5/modules/compactview/bynder-compactview-2-latest.js"></script>
    <script>
     BynderCompactView.open({
       language: "en_US",
       theme: {
         colorButtonPrimary: "#3380FF"
       },
       defaultSearchTerm: "Amsterdam",
       mode: "SingleSelect",
       onSuccess: function(assets) {
         console.log(assets);
         var importedAssetsContainer = document.getElementById(
           "importedAssets"
         );
         importedAssetsContainer.innerHTML = "";
         assets.forEach(function(asset) {
           switch (asset.type) {
             case "AUDIO":
             case "DOCUMENT":
             case "IMAGE":
               importedAssetsContainer.innerHTML +=
                 "<img src=" + asset.derivatives.webImage + " />";
               return;
             case "VIDEO":
               importedAssetsContainer.innerHTML +=
                 '<video width="640" height="480" controls>' +
                 '<source src="' +
                 asset.previewUrls[0] +
                 '" type="video/webm">' +
                 "</video>";
               return;
             default:
               return;
           }
         });
       }
     });
    </script>
  </body>
</html>

Once the assets are selected, they are submitted by the Compact View using CustomEvents. They will be returned in an array of objects that can be handled in your page. In the example above we use a div with id importedAssets that will be filled with the assets urls. This response array contains all of the information about the assets from the Bynder portal, including all public derivatives.

List of available asset derivatives can be retrieved by the API call: https://bynder.docs.apiary.io/#reference/account/derivative-operations/retrieve-derivatives.

Demo

For a working demo of the Compact View latest version check: https://bynder.github.io/bynder-compactview/.

Versions

2.0.0

Source: https://d8ejoa1fys2rk.cloudfront.net/5.0.5/modules/compactview/bynder-compactview-2-latest.js

New Features:

  • New design and improved UX to close the gap to Bynder's asset bank
  • New API to configure and initialize the Compact View according to your use case
  • Bynder domain URL validation in the Compact View landing page
  • Extended system language support for: English UK/US, Spanish, German, Dutch, French
  • Custom Smartfilter, metaproperty and metapropertyoption translations
  • Configure the look & feel through the new theme attribute
  • New attribute container to allow loading the Compact View inside any DOM element in your page
  • Simplified Compact View attributes

1.5.0

Source: https://d8ejoa1fys2rk.cloudfront.net/modules/compactview/includes/js/client-1.5.0.min.js

New Features:

  • New attribute data-shadowDom for toggling the usage of shadow DOM
  • New attribute data-modal for displaying the Compact View in a modal rather than in the parent element

1.4.0

Source: https://d8ejoa1fys2rk.cloudfront.net/modules/compactview/includes/js/client-1.4.0.min.js

New Features:

  • Added close button when autoload is not enabled
  • Improved authorisation error handling
  • Improved performance for large asset banks
  • Decreased bundle size by ~200kB - the most compact version yet!

1.3.0

Source: https://d8ejoa1fys2rk.cloudfront.net/modules/compactview/includes/js/client-1.3.0.min.js

New Features:

  • New attribute data-searchTerm for setting the initial search value

1.2.0

Source: https://d8ejoa1fys2rk.cloudfront.net/modules/compactview/includes/js/client-1.2.0.min.js

New Features:

  • New look and feel to more closely match Flagship experience
  • Added document and audio support (now supports all asset types!)
  • Added Smart Filter support
  • Added Advanced Filter
  • Added ability to open asset detail screen in new tab
  • Front end written completely in ReasonML
  • Back end written completely in OCaml

1.1.0

Source: https://d8ejoa1fys2rk.cloudfront.net/modules/compactview/includes/js/client-1.1.0.min.js

New Features:

  • Added video support
  • Added support for Safari and IE11
  • Configurable as multi select or single select

© 2019 Bynder All rights reserved.