React integration makes heavy use of React hooks, so you'll need to be on React 16.8 or greater
npm i @hubstairs/display-react
# or
yarn add @hubstairs/display-react
import Display from '@hubstairs/display-react'
const displayProps = {
displayid,
token,
}
function App() {
return <Display {...displayProps} />
}
If needed, you can find more details in the types declaration
displayProps
can receive the following data:
props name | default | description |
---|---|---|
displayid or displayUrl | Required. Either the id or the url of the nfinite Display. | |
token | Required. Token generated in my.nfinite.app (in the service user section). | |
responsive | true (if no width and height set) |
Resize according to its parent element, this parameter is incompatible with height and width parameters |
displayUrl | https://display.nfinite.app |
Override the generated base url for the Display (useful in development mode). |
oembedUrl | https://display.nfinite.app/api/oembed |
Override the generated base url for oembed api (useful in development mode). |
language | default language set in my.nfinite.app | One of the defined language in my.nfinite.app (in the platform section). |
onError | Callback on error | |
onReady | Callback when "ready" event is emitted |
props name | default | description |
---|---|---|
productcode | Load scenes where the product is visible (identified by its code) | |
onChangeScene |
Callback on scene change, it receives the new scene as argument |
props name | default | description |
---|---|---|
styles |
Override style of customizable elements | |
labels |
Customize labels (use also for i18n) |