Skip to content

Commit

Permalink
docs: add README example
Browse files Browse the repository at this point in the history
  • Loading branch information
adamstankiewicz committed May 29, 2024
1 parent 97a577b commit 9ead6aa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Hyperlink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ categories:
- Buttonlike
status: 'Needs Work'
designStatus: 'Done'
devStatus: 'To Do'
devStatus: 'Done'
notes: |
Improve prop naming. Deprecate content prop.
Use React.forwardRef for ref forwarding.
Expand Down Expand Up @@ -100,3 +100,18 @@ notes: |
</div>
</div>
```

## with custom link element

``Hyperlink`` typically relies on the standard HTML anchor tag (i.e., ``a``); however, this behavior may be overriden when the destination link is to an internal route where it should be using routing instead (e.g., ``Link`` from React Router).

```jsx live
<Hyperlink
as={GatsbyLink}
// `destination` is still a required prop even though the `to` takes precedence.
destination="/components/button"
to="/components/button"
>
Button
</Hyperlink>
```
1 change: 1 addition & 0 deletions src/Hyperlink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Hyperlink.defaultProps = {
};

Hyperlink.propTypes = {
/** specifies the component element type to render for the hyperlink */
as: PropTypes.elementType,
/** specifies the URL */
destination: PropTypes.string.isRequired,
Expand Down

0 comments on commit 9ead6aa

Please sign in to comment.