5.0.2 • Published 6 months ago
@bynder/compact-view v5.0.2
Bynder Compact View React Component
Usage example
import React, { useState } from 'react';
import { createRoot } from 'react-dom/client';
import { CompactView, Modal, Login } from '@bynder/compact-view';
const assetFieldSelection = `
name
url
originalUrl
derivatives {
thumbnail
webImage
}
... on Video {
previewUrls
}
`;
const App = () => {
const [isOpen, setIsOpen] = useState(false);
onSuccess(assets) {
console.log(assets);
}
render() {
return (
<>
<button onClick={setIsOpen(true)}>Open Compact View<button>
<Modal isOpen={isOpen} onClose={setIsOpen(false)}>
<Login>
<CompactView
language="en_US"
onSuccess={this.onSuccess}
assetFieldSelection={assetFieldSelection}
/>
</Login>
</Modal>
</>
);
}
}
const root = createRoot(document.getElementById('app'));
root.render(<App />);See more info on Bynder Docs
Configuration
The optional options object accepts the following attributes (which are also all optional):
| Attribute | Description | Possible Values | Default Value |
|---|---|---|---|
onSuccess | Comma separated list of asset types to display | function (assets: asset[], { selectedFile?: File })): void | console.log |
container | A DOM element to act as the container for Compact View (disables modal) | A Dom.HTMLElement instance | None |
portal | Portal config object | None | |
portal.url | Set a default portal URL for the Compact View login screen | A string containing Bynder portal URL | None |
portal.readOnly | If true, limits Compact View to a single portal | true, false | false |
defaultSearchTerm | Set the initial value for search term | "Keyword" | None |
language | Set language for the Compact View | "en_US", "nl_NL", "de_DE", "fr_FR", "es_ES", | "en_US" |
mode | Set the Compact View to allow multiple or single asset selection | "SingleSelect", "SingleSelectFile", "MultiSelect" | "MultiSelect" |
theme | A theme object for customizing Compact View look and feel | Object (see below for recognized keys) | None |
assetTypes | An array of strings for limiting allowed asset types | AssetType[] | ["image", "audio", "video", "document"] |
hideExternalAccess | If true, removes access to external DAM from assets and collections | true, false | false |
hideLimitedUse | If true, limited assets are hidden | true, false | false |
selectedAssets | An array of asset ids. When mode is different than MultiSelect, the last id in the array will be selected | ["id1", "id2", "id3"] | [] |
modalStyles | An object with css properties for modal wrapper using strings as keys and values { [key: string]: string } | {"width": "100%"} | None |
assetFieldSelection | A multiline string containing desired asset fields | string | None |
assetFilter | Set predefined filters for the Compact View | AssetFilterJson | None |
type File = {
url: string;
width?: number;
height?: number;
fileSize?: number;
};
type AssetFilterJson = {
predefinedAssetType?: AssetType[]; //predefined asset types
collectionId?: string; //predefined collection id
predefinedMetapropertiesOptions?: string[]; //predefined metaproperty IDs
searchTerm?: string; //predefined search term
predefinedTagNames?: string[]; //predefined tags
isLimitedUse?: boolean; //whether or not this asset is marked as Limited Use
showToolbar?: boolean; //show toolbar for predefined filters (false by default)
};
type AssetType = 'AUDIO' | 'DOCUMENT' | 'IMAGE' | 'VIDEO' | 'ARCHIVE';
type theme = {
colorPrimary?: CSSColor;
colorButtonPrimary?: CSSColor;
colorButtonPrimaryLabel?: CSSColor;
colorButtonPrimaryActive?: CSSColor;
colorButtonPrimaryHover?: CSSColor;
colorButtonPrimaryHoverLabel?: CSSColor;
};5.0.2
6 months ago
5.0.1
7 months ago
5.0.0
7 months ago
4.3.2
1 year ago
4.3.3
10 months ago
4.3.1
1 year ago
4.3.0
1 year ago
4.2.4
1 year ago
4.2.3
2 years ago
4.2.2
2 years ago
4.2.1
2 years ago
4.2.0
2 years ago
4.1.0
2 years ago
4.0.1
2 years ago
3.4.0
2 years ago
3.4.1
2 years ago
4.0.0
2 years ago
3.3.4
3 years ago
3.3.3
3 years ago
3.3.2
3 years ago
3.3.1
3 years ago
3.3.0
3 years ago
3.2.4
3 years ago
3.2.3
3 years ago
3.2.2
3 years ago
3.1.3
3 years ago
3.2.1
3 years ago
3.1.2
3 years ago
3.2.0
3 years ago
3.1.1
4 years ago
3.1.0
4 years ago
3.0.0
4 years ago
2.5.0
4 years ago
2.6.1
4 years ago
2.6.0
4 years ago
0.0.1-beta
4 years ago
2.4.3
4 years ago
2.4.2
4 years ago
2.4.1
4 years ago
2.4.0
4 years ago
2.2.0
5 years ago
2.1.0
6 years ago
2.0.0-rc.5
6 years ago
2.0.0-rc.4
6 years ago
2.0.0-rc.3
6 years ago
2.0.0-rc.2
6 years ago
2.0.0-rc.1
6 years ago
2.0.0-beta.2
6 years ago
2.0.0-beta.1
6 years ago
2.0.0-beta.0
6 years ago
2.0.0-alpha.0
6 years ago
1.5.0-beta.5
7 years ago
1.5.0-beta.4
7 years ago
1.5.0-beta.3
7 years ago
1.5.0-beta.2
7 years ago
1.5.0-beta.1
7 years ago
1.5.0-beta.0
7 years ago