@buildwithlayer/sdk
Installation
npm
npm install @buildwithlayer/sdk
Yarn
yarn add @buildwithlayer/sdk
Typescript
@buildwithlayer/sdk is writting in TypeScript and provides type definitions for all of its public APIs.
Basic Usage
import { Widget } from '@buildwithlayer/sdk';
function App() {
return (
<div className="App">
<Widget />
</div>
);
}
export default App;
Usage
import { Widget } from '@buildwithlayer/sdk';
function App() {
const name = 'John Doe';
const companyName = 'Acme Inc.';
return (
<div>
<Widget
// Optional title for the header
title="Optional Title"
// Optional function to render a logo in the header
renderLogo={() => <p>Logo</p>}
// Optional function to render a custom fab
renderFab={(onClick) => (
<button onClick={onClick}>Open Layer Assistant</button>
)}
// Optional string to override the default message in the chat
defaultMessage={`Hey there ${name}! Thanks for choosing ${companyName}! Ask me anything at all, and I will do it!`}
// Optional theme overrides
themeOverrides={{
palette: {
primary: {
main: '#000000',
},
secondary: {
main: '#ffffff',
},
},
}}
/>
</div>
);
}
export default App;