From 085466c113f250a70795102806a9856034f3f06e Mon Sep 17 00:00:00 2001
From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com>
Date: Thu, 27 Nov 2025 06:51:06 -0300
Subject: [PATCH] Add clickable href function
---
prompts.md | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/prompts.md b/prompts.md
index 2f377a6759..00d0c98fc4 100644
--- a/prompts.md
+++ b/prompts.md
@@ -19,6 +19,7 @@
- [Tables](#tables)
- [Spin](#spin)
- [Progress Bar](#progress)
+- [Hyperlink](#hyperlink)
- [Clearing the Terminal](#clear)
- [Terminal Considerations](#terminal-considerations)
- [Unsupported Environments and Fallbacks](#fallbacks)
@@ -919,6 +920,45 @@ foreach ($users as $user) {
$progress->finish();
```
+
+## Hyperlink
+
+The href function may be used to display clickable hyperlinks in supported terminals.
+When the terminal supports OSC-8 hyperlinks, the rendered text becomes an active link that can be opened directly.
+
+```php
+use function Laravel\Prompts\href;
+
+href(
+ message: 'Visit Laravel Documentation:',
+ path: 'https://laravel.com/docs',
+ tooltip: 'Laravel Documentation'
+);
+```
+
+If you omit the tooltip argument, the link text will default to the provided path:
+
+```php
+use function Laravel\Prompts\href;
+
+href(
+ message: 'Laravel Documentation:',
+ path: 'https://laravel.com/docs'
+);
+```
+
+You may also generate hyperlinks to local files:
+
+```php
+use function Laravel\Prompts\href;
+
+href(
+ message: 'Open current file:',
+ path: base_path('routes/web.php'),
+ tooltip: 'Route file'
+);
+```
+
## Clearing the Terminal