Time Picker

Do you need users to pick a time as part of an interactive flow? With the Time Picker element, Symphony users can easily select a time from a list of possible values.

The Time Picker offers to Symphony users the possibility to enter the time in two different ways:

  • Populating the field directly with the keyboard, following the appropriate format and the list of possible values (see attributes strict, min, max, and disabled-time)

  • Clicking on the wished time from the dropdown displayed

MessageML tag

The Time Picker is represented by the <time-picker> tag, as you can see in the examples at the bottom of the page.

Designs

You can see below the designs of the time picker.

Attributes

Accessibility

For the purpose of accessibility, Symphony users can interact with the time picker via their keyboard:

  • First, using "Tab" to enter the component

  • Using "Enter" or "Space" to open the dropdown when focus is on the icon, or just "Enter" when focus is on the input

  • Using "Arrow up" or "Arrow down" to navigate within the dropdown list and using "Enter" to select the preselected value

  • Either "Typing" or pressing "Tab" to go from the hours to the minutes, and then from the minutes to the seconds

  • Either "Deleting" or pressing "Shift+Tab" to go back from the seconds to the minutes, and then from the minutes to the hours

  • Finally using "Tab" to exit the component

Rules and Limitations

  • The max length of any time picker attribute is 256 except disabled-time attribute which max length is set to 1024 characters.

  • If the format entered by the user is not correct or if the time entered is a disabled time, then an error message is displayed to the user. Note that it is not possible for the user to submit the form with an invalid format or disabled time.

  • You can add a default time in your text field by including it in the value parameter. Please note that unlike the placeholder text, the default time will be sent back to the Bot in the user reply when the form is submitted if it is not edited by the user.

  • The time-picker will be supported on the following versions of clients:

    • 20.14 for Client 2.0

    • 20.13 for Client 1.5

Please note that a limited amount of values are displayed in the dropdown of the time picker (see attribute step which minimum is 10 min). However, you can note that the time picker supports a precision to the second (see format attribute). Also, if you don't use the attribute strict, then user will be able to populate the field via their keyboard with any other non-disabled and existing time value than proposed in the list.

Examples

The following examples show the time picker being used as follows:

  • The first time-picker (init) shows how to display a default time, as an initial value is entered as parameter. Note that the default value is present in the user reply as it has not been deleted before submitting the form.

  • The second time-picker (placeholder) shows how a placeholder is displayed in the UI. Please note that any text is accepted as input. However, if you compare with the next time-pickers present in the form, you can notice that a default placeholder is generated (with a hint of the correct format to accepted by the time-picker field) in case no placeholder is set.

  • The third time-picker (label) shows how a label ("My Label") is displayed.

  • The fourth time-picker (tooltip) shows how the title attribute ("My Tooltip/n With a second line") is displayed.

  • The fifth time-picker (noreq) shows how a user can interact with a non-required field. Even if the field is empty (only a placeholder text is present but does not count as a value), it does not prevent the user from submitting the form.

  • The sixth time-picker (req) shows the behaviour of the unique required field of the form, which cannot be submitted in case it is not filled.

  • The seventh time-picker (format) shows the way the placeholder evolves to adapt to a new format transmitted thanks to the format parameter. Also please note the accessible interaction with the time-picker via the keyboard.

  • The eighth time-picker (step) shows how to modify the step between 2 consecutive values in the list of times. Please note that a Symphony user can select any other existing time by populating the field with his keyboard.

  • The ninth time-picker (strict_step) shows how to enforce the user to choose among the non-disabled values displayed in the dropdown, thanks to the strict attribute.

  • The tenth time-picker (rules) shows how to interact with the following parameters: min, max, and disabled-time. Please note that a disabled time cannot be entered manually.

<messageML>
  <form id="form_id">
    <h2>time-pickers</h2>
      <time-picker name="init" label="With default value" value="13:51:06" />
      <time-picker name="placeholder" placeholder="Only Placeholder..." />
      <time-picker name="label" label="My Label" />
      <time-picker name="tooltip" label="With Tooltip" title="My Tooltip\n With a second line" />
      <time-picker name="noreq" placeholder="Not required" />
      <time-picker name="req" required="true" placeholder="Required" />
      <time-picker name="format" label="Other Format" format="hh:mm a" />
      <time-picker name="step" label="With a customed time-step" step="600" />
      <time-picker name="strict_step" label="Restricting values to the time-step defined" strict="true" />
      <time-picker name="rules" label="With Disabled values" min="08:00:00" max="17:00:00" disabled-time='[{"from": "12:00:00", "to": "14:00:00"}, {"time": "15:00:00"}]' />
      <button name="time-picker">Submit</button>
  </form>
</messageML>

Versions and Compatibility

Last updated