Keyboard

    Keyboard


    Article summary


    title: Keyboard

    version: 1.0.0
    layout: default
    sdk: core

    # Keyboard Module

    Version Keyboard 1.0.0

    Table of Contents

    Usage

    To use the Keyboard module, you can import it into your project from the Firebolt SDK:

    import { Keyboard } from '@firebolt-js/sdk'
    

    Overview

    Methods for prompting users to enter text with task-oriented UX

    Methods

    email

    Prompt the user for their email address with a simplified list of choices.

    function email(type: EmailUsage, message?: string): Promise<string>
    

    Parameters:

    ParamTypeRequiredDescription
    typeEmailUsagetrueWhy the email is being requested, e.g. sign on or sign up
    values: 'signIn' \| 'signUp'
    ,messagestringfalse

    Promise resolution:

    string
    

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:input:keyboard

    Examples

    Prompt the user to select or type an email address

    JavaScript:

    import { Keyboard } from '@firebolt-js/sdk'
    
    Keyboard.email("signIn", "Enter your email to sign into this app")
        .then(email => {
            console.log(email)
        })
    

    Value of email:

    "user@domain.com"
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "Keyboard.email",
    	"params": {
    		"type": "signIn",
    		"message": "Enter your email to sign into this app"
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": "user@domain.com"
    }
    

    Prompt the user to type an email address to sign up

    JavaScript:

    import { Keyboard } from '@firebolt-js/sdk'
    
    Keyboard.email("signUp", "Enter your email to sign up for this app")
        .then(email => {
            console.log(email)
        })
    

    Value of email:

    "user@domain.com"
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "Keyboard.email",
    	"params": {
    		"type": "signUp",
    		"message": "Enter your email to sign up for this app"
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": "user@domain.com"
    }
    

    password

    Show the password entry keyboard, with typing obfuscated from visibility

    function password(message?: string): Promise<string>
    

    Parameters:

    ParamTypeRequiredDescription
    messagestringfalseThe message to display while prompting

    Promise resolution:

    string
    

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:input:keyboard

    Examples

    Prompt the user to enter their password

    JavaScript:

    import { Keyboard } from '@firebolt-js/sdk'
    
    Keyboard.password("Enter your password")
        .then(value => {
            console.log(value)
        })
    

    Value of value:

    "abc123"
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "Keyboard.password",
    	"params": {
    		"message": "Enter your password"
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": "abc123"
    }
    

    standard

    Show the standard platform keyboard, and return the submitted value

    function standard(message: string): Promise<string>
    

    Parameters:

    ParamTypeRequiredDescription
    messagestringtrueThe message to display while prompting

    Promise resolution:

    string
    

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:input:keyboard

    Examples

    Prompt the user for an arbitrary string

    JavaScript:

    import { Keyboard } from '@firebolt-js/sdk'
    
    Keyboard.standard("Enter the name you'd like to associate with this device")
        .then(value => {
            console.log(value)
        })
    

    Value of value:

    "Living Room"
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "Keyboard.standard",
    	"params": {
    		"message": "Enter the name you'd like to associate with this device"
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": "Living Room"
    }
    

    Types

    EmailUsage

    enum EmailUsage {
    	SIGN_IN = 'signIn',
    	SIGN_UP = 'signUp'
    }
    
    


    Was this article helpful?

    What's Next