Skip to content

Commit 13b0c1a

Browse files
committed
docs(ui-link): add advanced example to docs
INSTUI-4543
1 parent 1ac0a2d commit 13b0c1a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/ui-link/src/Link/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,25 @@ type: example
2222
</View>
2323
```
2424

25+
### Controlled navigation
26+
27+
Sometimes a simple `Link (<a>)` with an `href` is not enough for navigation and an `onClick` handler is needed. In this case, the recommended approach is the following
28+
29+
```js
30+
---
31+
type: example
32+
---
33+
<Link
34+
variant="standalone"
35+
onClick = {(e)=>{
36+
e.preventDefault()
37+
console.log("do navigation")
38+
}}
39+
forceButtonRole={false}
40+
href="#">Go to places
41+
</Link>
42+
```
43+
2544
### Variant
2645

2746
In order to make it easy to get the most commonly used links, we have the variant prop. It will set all the necessary styles (fontSize, lineHeight, and textDecoration).

0 commit comments

Comments
 (0)