ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

amp-autocomplete: Multiple element tokenisation #35487

Open AaronMLB opened 3 years ago

AaronMLB commented 3 years ago

Description

I would like to offer users of my website the ability to select one-or-more items from a list of suggestions, and to tokenise them as selected objects rather than plain text.

auto-complete already comes quite close to this with both suggesting based on initial user input and the inline attribute that enables multiple items to be suggested and selected, so it feels a logical feature extension to that component rather than a whole new one.

Unlike inline however, selected items would be tokenised as a single selected element rather than remain as plain text, and no triggering character would be required.

Possible use cases include assigning categorisations and labels/tags to records; specifying multiple recipients in a messaging system; or perhaps a search function with advanced filtering options.

It should also be possible to pre-set tokenised elements to display on page load for the purposes of direct links into a specific setting, edit screens, and the like.

Alternatives Considered

There are various free and commercial scripts in both vanilla JavaScript and as plugins for popular libraries/frameworks that provide such functionality, but none that would be AMP-friendly.

A particularly simple example can be viewed here, which offers the additional functionality of being able to create a new tokenised element as well as offering from a pre-defined list: this would be a very useful option to have in some use cases.

A similar jQuery plugin is provided here.

A plugin called Tokenfield for the Bootstrap UI framework has similar functionality and options.

Additional Context

No response

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

AaronMLB commented 2 years ago

This would still be a very appreciated feature.