#Prompts - additional description/tooltip

6 messages · Page 1 of 1 (latest)

ember ocean
#

HI all

Prompts allow to provide a hint that would appear under the filed. That hint is great, but it is intended to have minimal content to provide some sort of an examloe value to the field.

I want to be able to provide a more extended description text.

The use case is simple: sometimes the prompt options do not describe enough and users have troubles making a choice. Having a tooltip-like experience would allow them to read more without leaving the CLI.

A user would press something on the field to go to another screen to read the description and would come back. This would be similar to how in HTML pages we have an 'i' icon next to the input that, when clicked, shows a tooltip with additional description.

Has anyone considered this/implemented something like this?

Thank you

lusty veldt
#

You could try and build your own prompt for this behavior. But really though, it sounds like you're trying to add interactive UI elements to a terminal.

It sounds like what you want to do instead, is create a web interface where making these things are trivial.

west oxide
#

I haven't tried it myself but you might be able to add an info symbol with a link like this

<href=https://example.com> ⓘ</>

#

Sorry. Discord mangles the tags and I can't format it correctly on mobile. Will update it when I'm back at my laptop.

#

This works:

$type = text(
    label: 'Enter type',
    hint: '<href=https://example.com>ⓘ See docs for more info</>'
);
#

BTW Prompts has to keep track of how many lines a prompt uses so that it knows how many lines to remove when they're no longer necessary. I used to think "How hard could it be?" until I submitted a PR myself and found out the hard way 🤣