Components
Properties Glossary
Every property accepted by CMEmbed.PageComponent.
All properties are passed in the object given to CMEmbed.PageComponent({ ... }). Only client is required. See Web Usage for a complete configuration.
Properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
client | string | Yes | Your client identifier, from your client success representative. Use benovo (the demo client) for testing. A value like acme-east is read as client acme with sub-brand east. | |
env | 'demo' | 'production' | No | 'production' | demo shows development.crediblemind.com for your client, with the newest features; with embed-v2-dev.js it shows the preview of the new experience, embedded.crediblemind.com (see Web Usage). production shows https://{client}.crediblemind.com. |
subBrand | string | No | Part of client after the first - | Sub-brand within your organization. |
type | 'full' | 'bare' | No | 'full' | bare hides CredibleMind's header, footer and main navigation. full shows the complete site. |
components | string[] | No | [] | The page to show when the URL has no cm_page parameter, for example ['topics/anxiety']. Only the first item is used. With neither, the home page is shown. |
parent | window.location or () => string | No | Where to read the cm_page parameter from. Pass window.location (the object, not a string), or a function that returns the current URL. Without it, cm_page is ignored and only components is used. | |
redirect | 'in_app' | 'new_tab' | No | 'in_app' | in_app keeps navigation inside the embed. new_tab opens links on your standalone CredibleMind site in a new tab. |
onRouteChange | (route: string) => void | No | Called when the user navigates inside the embed. See onRouteChange. | |
setIframeHeight | (height: number) => void | No | Called with the content height so you can resize the iframe. Without it the iframe is 1000px tall and scrolls inside itself. | |
onModalOpen | () => { top: number, left: number } | No | Return your page's scroll offsets so dialogs and the mobile filter panel open in view. Without it the embed uses its own position. | |
onScrollTo | (position: number) => void | No | Scroll your page to position when the embed needs to scroll: after changing page, and for in-page jumps such as a topic's section links. Without it the embed scrolls its own window. In-page jumps need both onScrollTo and onModalOpen to move your page in every browser; without them they work in Chrome but not Safari. | |
styles | object | No | Appearance. See styles. | |
controls | object | No | Show or hide parts of pages. See controls. | |
urlParams | string | No | Extra query parameters added to the embedded page, for example 'view=carousel&numcards=3'. |
onRouteChange
Receives the new page path without a leading /, including any query string, for example topics/anxiety or lists/after-the-storm?view=carousel. When the user's language is not English, lang= is added, for example topics/anxiety?lang=es. It receives an empty string when the user returns to the home page.
The usual handler writes the route into the cm_page parameter so the URL can be bookmarked:
onRouteChange: route => {
const page = route.length > 1 ? '?cm_page=' + route : window.location.pathname
history.replaceState(null, null, page)
if (!route) window.location.reload()
}With redirect: 'new_tab', links open on your standalone site instead, so onRouteChange can be left out.
styles
| Key | Type | Description |
|---|---|---|
backgroundColor | string | Background of the embedded pages. Any valid CSS colour, for example '#fafafa' or 'rebeccapurple'. Invalid values are ignored and the background stays white. |
containerPadding | string | Padding around the embedded content, as one to four CSS lengths, for example '20px 15px'. Invalid values are ignored. |
styles: {
backgroundColor: '#fafafa',
containerPadding: '20px 15px'
}controls
| Key | Type | Default | Description |
|---|---|---|---|
hideHeader | boolean | false | Hide the page header on listing pages: topics, articles, assessments, practices, resources, lists (including a single list), series and saved resources. On All Topics the search box stays, above the results. |
hideSidebar | boolean | false | Hide the side panel on resource pages (articles, FAQs, videos, podcasts, books, apps, practices, organizations and people), showing only the main content. Books keep their Where to Find links. Filters on listing pages are controlled by showFilters. |
showFilters | boolean | false | Show the filters on listing pages (topics, practices, resources, lists, series, assessments and saved resources), on desktop and mobile. Embedded listing pages hide them unless this is true. Search always stays, and so does sort, except on All Topics, where sort shows only with showFilters. |
hideHeroLanding | boolean | false | Hide the hero banner on the home page. type: 'bare' hides it already. |
controls: {
hideHeader: true,
hideSidebar: true,
showFilters: true
}