Leopard Chat Client
  • Quick Start
  • Screenshots
  • Setup
    • Extension Helper
    • Context Variables
      • Greeting Message
      • Channel
      • User's Time Zone
      • Location Context Parameters
    • Build Variables
  • Content Styling
    • CSS Styles
    • Icons
    • Markdown & HTML
  • Components Simple Syntax
  • Components
    • Answer Borders
    • Audio Player
    • Auto Open Leopard with Link
    • Alerts
    • Buttons and Lists
    • Card
    • Response Icons
    • Date & Time Pickers
    • Emergency Button
    • Expensive Operations
    • Field Masks
    • Chat Field Types (Email, Password, Location, Upload)
    • Forms
      • Feedback Form
      • Custom Forms
        • Example Config
        • Postback Object
        • Button Object
        • Field Types
        • Style Object
        • Icons Object
        • Masks
        • Validation
    • Google Map
    • Help Text
    • HTML Modal
    • Hyperlinks
    • Images
      • Image
      • Image Carousel
    • Tables
      • Tables - Simple
      • Tables - Advanced
    • Theme Change
    • Toasts
    • Language Auto Switch
    • Minimize Chat after Delay
    • Multiple Components - Same Response
    • Modal Size & Positioning
    • Open Long Response in Modal
    • Print Icon
    • Prompt Trigger Polling
    • Splitting Answers - Chunks
    • Video Player
  • Administration Area
    • Solution Configuration
    • Demo Mode - iFrames & URLs
    • ASR and TTS
  • Integrations
    • Logging / Reporting
    • Social Authentication
    • Live Chat
  • Embedding / Production
Powered by GitBook
On this page
  • Screenshot
  • Output Parameter
  • Example
  • JSON
  1. Components

HTML Modal

Leopard allows you to create a custom modal layout with a mix of available components (images, carousels, video, audio, html and titles) in any order.

PreviousHelp TextNextHyperlinks

Last updated 5 years ago

Screenshot

Output Parameter

extensions = ${ExtensionHelper.displayModal(model, template)}

Where model would be a flow or global map containing keys and values.

Example

def model = [
	myTitle: "This is a flexable modal",
	mySubtitle: "My SubTitle",
	myBody: "This is the body HTML...",
	myOtherBitOfText: "This is more HTML... This is more <b>HTML...</b> This is more HTML... This is more HTML... ",
	myImage1: "https://cdn.pixabay.com/photo/2018/08/03/14/00/vw-beetle-3581950__340.jpg",
	myImage2: "https://cdn.pixabay.com/photo/2018/03/08/21/51/lake-3209994__340.jpg",
	myImageCarousel: ["https://cdn.pixabay.com/photo/2017/08/03/11/28/ferris-wheel-2575709__340.jpg", "https://cdn.pixabay.com/photo/2016/11/23/15/54/architecture-1853687__340.jpg"],
	myYouTube: "https://www.youtube.com/watch?v=rayiRwxUGdk",
	myAudio: "https://www.mfiles.co.uk/mp3-downloads/chopin-nocturne-op9-no2.mp3"
]

A template variable (flow or global) then needs to be define:

  • the presentation order of the items found in the model

  • the presentation component type for each item

template = '''
title.myTitle
audio.myAudio
subtitle.mySubtitle
image.myImage1
html.myBody
carousel.myImageCarousel
html.myOtherBitOfText
youTube.myYouTube
image.myImage2
'''

Then add the following output parameter to an output node in Studio

extensions = ${ExtensionHelper.displayModal(model, template)}

JSON

{
  "name"  : "displayModal",
  "items" : [
    {
      "type"  : "title",
      "value" : "This is a flexable modal"
    },
    {
      "type"  : "audio",
      "value" : "https://www.mfiles.co.uk/mp3-downloads/chopin-nocturne-op9-no2.mp3"
    },
    {
      "type"  : "subtitle",
      "value" : "My SubTitle"
    },
    {
      "type"  : "image",
      "value" : "https://cdn.pixabay.com/photo/2018/08/03/14/00/vw-beetle-3581950__340.jpg"
    },
    {
      "type"  : "html",
      "value" : "This is the body HTML..."
    },
    {
      "type"  : "carousel",
      "value" : [
        "https://cdn.pixabay.com/photo/2017/08/03/11/28/ferris-wheel-2575709__340.jpg",
        "https://cdn.pixabay.com/photo/2016/11/23/15/54/architecture-1853687__340.jpg"
      ]
    },
    {
      "type"  : "html",
      "value" : "This is more HTML... This is more <b>HTML...</b> This is more HTML... This is more HTML... "
    },
    {
      "type"  : "youTube",
      "value" : "https://www.youtube.com/watch?v=rayiRwxUGdk"
    },
    {
      "type"  : "image",
      "value" : "https://cdn.pixabay.com/photo/2018/03/08/21/51/lake-3209994__340.jpg"
    }
  ]
}