Usage
The Anchor Link component is a wrapper around the HTML anchor <a>
tag, providing a consistent way to navigate between pages in your Dev Portal.
The Anchor Link component styles are inherited from the Portal's native anchor tag styles and will inherit styles from any CSS custom property or global CSS overrides. To use the Anchor Link component in your Markdown and MDC files, you can use the following component tag:
::a
---
href: "/components/button"
display: "inline"
---
This is a link
::
You can even use the Anchor Link component inside other components, such as an Alert:
::alert
---
appearance: "success"
show-icon: true
---
View the
::a
---
href: "/components/alert"
---
alert component docs
::
for more information.
::
Props
href
The URL or absolute path for the link to navigate to when clicked.
- Type:
string
- Default:
''
The href
prop can accept different types of values:
- Provide an absolute path to easily allow navigating across your Dev Portal:
/components/button
- Provide a full URL to navigate to another website:
https://konghq.com
(you may also want to settarget="_blank"
to open in a new tab) - Provide a hash as the
href
to scroll to an element with anid
attribute on the same page:#slots
target
Where to display the linked URL, as the name for a browsing context.
- Type:
'_blank' | '_parent' | '_self' | '_top' | null | undefined
- Default:
''
rel
A rel attribute value to apply on the link. Defaults to 'noopener noreferrer'
for external links.
- Type:
'noopener' | 'noreferrer' | 'nofollow' | 'sponsored' | 'ugc' | null | undefined
- Default:
''
display
The display type of the component. Accepts the CSS values for 'display'.
- Type:
string
- Default:
'inline'
Shared Props
This component also includes the shared props listed below:
display
- default isinline
margin
- default isnull
padding
- default isnull
styles
- default is''
See here for more information on shared props.
Slots
default
Use the #default
slot to add link text.