prompts icon indicating copy to clipboard operation
prompts copied to clipboard

Add clickable Link prompt

Open luanfreitasdev opened this issue 6 months ago • 7 comments

Sometimes we want to show a clickable link to the user, so this PR adds the "link" functionality, which is supported by most current terminals on Linux and macOS.

link(
    message: 'Visit Laravel documentation:',
    path: 'https://laravel.com/docs',
    tooltip: 'Click here'
);

image

luanfreitasdev avatar Jun 11 '25 21:06 luanfreitasdev

IMO this seems out of scope for this project.

weitzman avatar Aug 16 '25 10:08 weitzman

@weitzman If prompts supports colours (which is extended terminal capability), why it should not support links?

AlexSkrypnyk avatar Nov 09 '25 05:11 AlexSkrypnyk

These links are great in CLI apps, but its not a Prompt IMO. There is no interactivity. I guess there are Informational Messages and Tables and other bits in this package that have no interactivity so the maintainers should feel free to include this.

weitzman avatar Nov 15 '25 13:11 weitzman

@luanfreitasdev I've read the code more carefully. Looks like the link is its own element. Is it possible to implement it as a formatter which could be used within existing textual parts of any prompt component? E.g., in hints or labels

AlexSkrypnyk avatar Nov 25 '25 20:11 AlexSkrypnyk

@luanfreitasdev I've read the code more carefully. Looks like the link is its own element. Is it possible to implement it as a formatter which could be used within existing textual parts of any prompt component? E.g., in hints or labels

I understand. Any ideas for an API with a display sample?

luanfreitasdev avatar Nov 25 '25 21:11 luanfreitasdev

Updated:

image

luanfreitasdev avatar Nov 26 '25 00:11 luanfreitasdev

Ready for review

luanfreitasdev avatar Nov 26 '25 00:11 luanfreitasdev