Keyboard

    Keyboard


    Article summary


    title: Keyboard

    version: 0.5.3
    layout: default
    sdk: core

    # Keyboard Module

    Version 0.5.3

    OpenRPC

    This document was generated from an OpenRPC JSON-Schema, and is intended to provide a human readable overview and examples of the methods contained in the module.

    For the full schema, see the link below.

    Schema
    keyboard.json

    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

    Events

    Methods

    email

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

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

    Parameters

    ParamTypeRequiredSummary
    typeEmailUsagetrueWhy the email is being requested, e.g. sign on or sign up
    messagestringfalseThe message to display while prompting

    Promise Resolution

    TypeDescription
    stringthe selected or entered email

    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

    ParamTypeRequiredSummary
    messagestringfalseThe message to display while prompting

    Promise Resolution

    TypeDescription
    stringthe selected or entered password

    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

    ParamTypeRequiredSummary
    messagestringtrueThe message to display while prompting

    Promise Resolution

    TypeDescription
    stringthe selected or entered text

    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"
    }
    

    Schemas

    EmailUsage

    type EmailUsage = 'signIn' | 'signUp'
    


    Was this article helpful?

    What's Next