|
| 1 | +# Links |
| 2 | + |
| 3 | +A component for displaying external links with consistent styling. Perfect for showcasing related resources, external documentation, or social media links. |
| 4 | + |
| 5 | +## Props |
| 6 | + |
| 7 | +| Name | Type | Default | Description | |
| 8 | +| ------- | --------------- | ----------- | --------------------------------------- | |
| 9 | +| `item` | `NqLinksItem` | `undefined` | Single link item to display | |
| 10 | +| `items` | `NqLinksItem[]` | `undefined` | Array of multiple link items to display | |
| 11 | + |
| 12 | +### NqLinksItem Interface |
| 13 | + |
| 14 | +| Name | Type | Default | Description | |
| 15 | +| ------- | -------- | ----------- | ---------------------------------------------- | |
| 16 | +| `label` | `string` | required | The text displayed for the link | |
| 17 | +| `href` | `string` | required | The URL the link points to | |
| 18 | +| `icon` | `string` | `undefined` | Optional icon class (e.g., `i-nimiq:external`) | |
| 19 | +| `title` | `string` | `undefined` | Optional tooltip text for accessibility | |
| 20 | + |
| 21 | +All links automatically open in a new tab with `target="_blank"` and include `rel="noopener noreferrer"` for security. |
| 22 | + |
| 23 | +> [!TIP] |
| 24 | +> Remember to [register `NqLinks`](/vitepress-theme/#register-the-components) in your app. |
| 25 | +
|
| 26 | +## Examples |
| 27 | + |
| 28 | +### Single Link |
| 29 | + |
| 30 | +Display a single external link with an icon. |
| 31 | + |
| 32 | +<ComponentPreview lang="vue"> |
| 33 | + |
| 34 | +<NqPlayground> |
| 35 | +<NqLinks :item="{ |
| 36 | + label: 'GitHub Repository', |
| 37 | + href: 'https://github.com/nimiq/ui', |
| 38 | + icon: 'i-nimiq:external', |
| 39 | + title: 'View source code on GitHub' |
| 40 | +}" /> |
| 41 | +</NqPlayground> |
| 42 | + |
| 43 | +</ComponentPreview> |
| 44 | + |
| 45 | +### Multiple Links |
| 46 | + |
| 47 | +Display multiple related links in a horizontal layout. |
| 48 | + |
| 49 | +<ComponentPreview lang="vue"> |
| 50 | + |
| 51 | +<NqPlayground> |
| 52 | +<NqLinks :items="[ |
| 53 | + { |
| 54 | + label: 'Documentation', |
| 55 | + href: 'https://docs.nimiq.com', |
| 56 | + icon: 'i-nimiq:book', |
| 57 | + title: 'Read the documentation' |
| 58 | + }, |
| 59 | + { |
| 60 | + label: 'Discord', |
| 61 | + href: 'https://discord.gg/nimiq', |
| 62 | + icon: 'i-nimiq:chat', |
| 63 | + title: 'Join our Discord community' |
| 64 | + }, |
| 65 | + { |
| 66 | + label: 'Twitter', |
| 67 | + href: 'https://twitter.com/nimiq', |
| 68 | + icon: 'i-nimiq:twitter', |
| 69 | + title: 'Follow us on Twitter' |
| 70 | + } |
| 71 | +]" /> |
| 72 | +</NqPlayground> |
| 73 | + |
| 74 | +</ComponentPreview> |
| 75 | + |
| 76 | +### Links Without Icons |
| 77 | + |
| 78 | +Simple text links without icons for minimal designs. |
| 79 | + |
| 80 | +<ComponentPreview lang="vue"> |
| 81 | + |
| 82 | +<NqPlayground> |
| 83 | +<NqLinks :items="[ |
| 84 | + { |
| 85 | + label: 'Terms of Service', |
| 86 | + href: '/terms' |
| 87 | + }, |
| 88 | + { |
| 89 | + label: 'Privacy Policy', |
| 90 | + href: '/privacy' |
| 91 | + }, |
| 92 | + { |
| 93 | + label: 'Contact', |
| 94 | + href: '/contact' |
| 95 | + } |
| 96 | +]" /> |
| 97 | +</NqPlayground> |
| 98 | + |
| 99 | +</ComponentPreview> |
| 100 | + |
| 101 | +## Usage Notes |
| 102 | + |
| 103 | +- Use either `item` for a single link or `items` for multiple links, not both |
| 104 | +- If both props are provided, `items` takes precedence |
| 105 | +- Links are displayed with consistent spacing using `flex="~ gap-8"` |
| 106 | +- The component uses Nimiq's pill styling (`nq-pill-secondary`) and arrow indicator (`nq-arrow`) |
| 107 | +- All links automatically include security attributes for external navigation |
0 commit comments