mount()
Mount any Inline AI placement type into a target DOM element, with full control over injection target, position, dimensions, and overlay behavior.
The mount() method renders an Inline AI placement into your page. You choose the placement type, tell the SDK where to inject it, and optionally pass display options to configure its appearance and behavior. mount() returns a placement ID that you can later pass to unmount() to remove it.
Signature
mount(
type: SDKPlacementType,
target?: InjectConfig | string,
options?: MountOptions
): string | undefinedParameters
typeSDKPlacementTypeRequiredThe type of placement to mount. Use a value from the Placement enum or the equivalent raw string.
| Enum constant | String value | Requires target |
|---|---|---|
Placement.SearchEmbed | 'search-embed' | Yes |
Placement.SearchIcon | 'search-icon' | Yes |
Placement.SearchFab | 'search-fab' | No |
Placement.BasicEmbed | 'basic-embed' | Yes |
Placement.KeyTakeaways | 'key-takeaways' | Yes |
Placement.SingleQuestion | 'single-question' | Yes |
Placement.Widget | 'widget' | No |
targetInjectConfig | stringWhere to inject the placement in the page DOM. Omit for body-level placements (Widget, SearchFab).
Pass a string as shorthand for targeting an element by its id attribute; 'my-container' is equivalent to { containerId: 'my-container' }.
Pass an InjectConfig object for more control:
optionsMountOptionsDisplay and behavior options for the placement.
Return value
idstring | undefinedA stable placement ID string. Pass this to unmount() to remove the placement later. Returns undefined if the mount failed (for example, if the target element was not found). Errors are logged to the console; the method itself does not throw.
Examples
var { Placement, InputShape, OpenOverlayOn } = window.InlineAI;
window.InlineAI.mount(Placement.SearchEmbed, 'search-container', {
placeholder: 'Search for answers...',
shape: InputShape.RoundedRectangle,
openOverlayOn: OpenOverlayOn.Focus,
});