display_action_screen()
  • 1 Minute to read

display_action_screen()


Article summary

This function displays a call-to-action screen.

Call-to-action (CTA) component is used in your app to guide users towards your goal conversion. It’s the perfect component when the user needs to click in order to take the action you want them to take. Some of the most popular usages for this component are ‘Welcome screen’ and ‘Confirmation screen’.

Reference

Screen Shot 2022-07-07 at 11.06.04 AM.png

Explore more about this component here

Arguments

ArgumentsTypeDefault Value
titlestringTitle of the screen (mandatory)
title_sizeenumUI_TITLE_SIZE.MEDIUMSize of the title
subtitlestringsubtitle of the screen (optional)
button_textstringtext of CTA button(mandatory)
show_back_buttonboolFalseShow a button to go back
back_button_textstring"Back"Text of the back button
button_sizeint1Button size (1 = SMALL, 2 = MEDIUM, 3 = LARGE)
languageslistNonelist of languages available for selection on the screen
chosen_languageanyNonethe language chosen for the screen (from languages list)
themeenumUI_THEME_TYPE.DARKEnum to define the theme of the screen, check UI_THEME_TYPE
custom_styledictNoneDictionary containing custom styles for the modal (optional)
waitboolTrueBool indicating to wait for user response (optional)
callbackcallableNoneCallable function to handle the response (optional)

See the complete list of general enumerations.

Return

Dictionary that contains the action performed by the user.
The first key-value pair will be 'action' : 'button_clicked'.

Exceptions

  • RayaUIMissingValue
  • RayaNeedCallback

See the complete list of ui exceptions and the complete list of general exceptions.

Callback Arguments

callback

ArgumentTypeDescription
datadictDict containing the result of the action

Example

...

class RayaApplication(RayaApplicationBase):

    async def setup(self):
        self.UI = await self.enable_controller('ui')
        ....
        
    async def loop(self):
     ....
        response = await self.UI.display_action_screen(
            title="Hey there!", 
            subtitle="Good morning", 
            button_text="Let's start", 
            theme=THEME_TYPE.DARK
        )
        self.log.info(response)
      ...
      
    async def finish(self):
      ...

...
"""
This shows:
{'action': 'button clicked'}
"""

Was this article helpful?