question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxInput proposal

See original GitHub issue

This is a proposal for a new component in grommet version 2. The purpose of the component is to simplify the experience of adding text data that requires a certain syntax, such as IP addresses, data and time strings, etc.

Some notable aspects:

  • The caller would specify a schema describing the available syntax.
  • A placeholder will be generated if one isn’t provided.
  • The user could tab between input segments.
  • The user does not have to type the separator characters but they will be allowed to if they want to.
  • Any options would be rendered as a drop down when the user is interacting with a particular segment.
  • The user could paste an entire value and it will be coerced into the schema if possible.

Here is an example of using the component to capture a time value:

<SyntaxInput
  schema={[
    {
      length: 2,
      options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
      placeholder: 'hh',
    },
    { separator: ':' },
    {
      length: 2,
      options: ['00', '15', '30', '45'],
      placeholder: 'mm',
    },
    { separator: ' ' },
    {
      length: 2,
      options: ['am', 'pm'],
      placeholder: 'ap',
    }
  ]}
  value={value}
  onChange={this.onChange}
/>

Please let us know if this is of interest and any feedback you might have.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ericsoderberghpcommented, Nov 27, 2018

Agreed on using this for credit cards, where after the first few digits are typed, the schema can be adjusted to align with the type of card.

I wasn’t thinking a single SyntaxInput would be used for all fields you mention.

0reactions
c0rv4xcommented, Jan 24, 2019

Hi! Sorry to bump this thread, but how would you implement a submit function once the enter is pressed? I was thinking about Keyboard but that event would grab all the enters that were pressed

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Proposal of an Input Interface to Syntax :Collaboration of Syntax ...
Semantic Scholar extracted view of "A Proposal of an Input Interface to Syntax :Collaboration of Syntax with Pragmatics" by 中島 平三.
Read more >
QiChat - Syntax — Aldebaran 2.1.4.13 documentation
Syntax. proposal: %tag sentence u:(input) %tag answer. Usage. Allows you to identify one or several proposal(s) or rule(s) by a tag.
Read more >
QiChat - Syntax - QiSDK
Syntax. proposal: %bookmark sentence u:(input) %bookmark answer. Usage. Allows you to identify one or several proposal(s) or rule(s) by a Bookmark.
Read more >
Re: a modest proposal for input syntax - GNU mailing lists - GNU.org
Subject: Re: a modest proposal for input syntax ... Bert > My biggest problem in typing input is getting notes in the correct...
Read more >
Proposal: New callback syntax closer to function signature - Dash ...
Secondly, the new syntax is more compact (at least in the current form). Rather than importing “Input/Output/State”, you only need a single “prop”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found