Skip to content

Commit 3a2cb71

Browse files
authored
Merge pull request #1359 from primer/link
Update Link docs
2 parents 3e4a489 + 229059a commit 3a2cb71

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

docs/content/components/links.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,42 @@ bundle: links
1010
Please note Primer v16 has changed the naming of these color classes. Check the <a href="/css/support/v16-migration">migration guide</a> to make sure your app is up to date.
1111
</Note>
1212

13-
By default `<a>` elements already use the right link color and apply an underline on hover.
13+
By default `<a>` elements already use the right link color and apply an underline on hover. So in most cases the `.Link` class is not really needed.
1414

1515
```html live
16-
Some text with a default <a href="#url">link</a>
17-
```
18-
19-
If you need to make other elements behave like a link and perhaps use JS to trigger navigating to another page, use the `.Link` class.
20-
21-
```html live
22-
Some text with a <span class="Link">span that behaves like a link</span>
16+
Some text with a <a href="#url">link</a>
17+
Some text with a <a href="#url" class="Link">link</a>
2318
```
2419

2520
If you like to override the default link styles you can do so with the following link utilities. **Bear in mind that link styles are easier for more people to see and interact with when the changes in styles do not rely on color alone.**
2621

22+
## Primary link
23+
2724
Use `.Link--primary` to turn the link color to blue only on hover.
2825

2926
```html live
3027
<p class="color-text-secondary">Some text with a <a class="Link--primary" href="#url">Link--primary</a></p>
3128
```
3229

30+
## Secondary link
31+
3332
Use `.Link--secondary` for a more subtle link color that turns blue on hover.
3433

3534
```html live
3635
Some text with a <a class="Link--secondary" href="#url">Link--secondary</a>
3736
```
3837

38+
## Muted link
39+
3940
Use `.Link--muted` also removes the underline on hover. Tip: You can also use the `.no-underline` utility to do the same for `.Link--primary`.
4041

4142
```html live
4243
<p>Some text with a <a class="Link--secondary no-underline" href="#url">Link--muted</a></p>
4344
<p>Some text with a <a class="Link--primary no-underline" href="#url">Link--primary no-underline</a></p>
4445
```
4546

47+
## On hover link
48+
4649
Use `.Link--onHover` to make any text color used with links to turn blue on hover. This is useful when you want only part of a link to turn blue on hover.
4750

4851
```html live
@@ -51,6 +54,18 @@ Use `.Link--onHover` to make any text color used with links to turn blue on hove
5154
</a>
5255
```
5356

57+
## Nested link
58+
59+
The `.Link` class can be nested inside an `<a>` element if only part of it should be styled like a link.
60+
61+
```html live
62+
<a class="color-text-primary no-underline" href="#url">
63+
A nested <span class="Link">Link</span>
64+
</a>
65+
```
66+
67+
## Link and color utilities
68+
5469
Link classes in combination with [color utilities](../utilities/colors) lets you colorize information separately inside of a link but have all of the link turn into one color on hover.
5570

5671
```html live

0 commit comments

Comments
 (0)