Hyperlink
minimal usage
Any Paragon component or export may be added to the code example.
<Hyperlink destination="https://www.edx.org">edX.org</Hyperlink>
with blank target
Any Paragon component or export may be added to the code example.
<Hyperlink destination="https://www.edx.org" target="_blank">edX.org</Hyperlink>
blank target without Icon
Any Paragon component or export may be added to the code example.
<Hyperlink destination="https://www.edx.org" target="_blank" showLaunchIcon={false}>edX.org</Hyperlink>
with onClick
Any Paragon component or export may be added to the code example.
<Hyperlinkdestination="https://www.edx.org"target="_blank"onClick={e => {e.preventDefault();console.log('click');}}>edX.org</Hyperlink>
with icon
Any Paragon component or export may be added to the code example.
<Hyperlink destination="https://www.edx.org"><Iconid="SampleIcon"className="fa fa-book"screenReaderText="Visit edX Home"/></Hyperlink>
color variants
Any Paragon component or export may be added to the code example.
<div className="d-flex flex-column"><Hyperlink destination="https://www.edx.org">Default</Hyperlink><Hyperlink variant="muted" destination="https://www.edx.org">Muted</Hyperlink><Hyperlink variant="brand" destination="https://www.edx.org">Brand</Hyperlink></div>
link variants
Any Paragon component or export may be added to the code example.
<div className="row"><div className="col-2"><Hyperlink destination="https://www.edx.org">Standalone</Hyperlink></div><div className="col-2"><Hyperlink isInline destination="https://www.edx.org">Inline</Hyperlink></div></div>
Props API#
- destination
string
Requiredspecifies the URL
- children
node
RequiredContent of the hyperlink
- className
string
Custom class names for the hyperlink
- target
string
Default'_self'specifies where the link should open. The default behavior is
_self
, which means that the URL will be loaded into the same browsing context as the current one. If the target is_blank
(opening a new window)rel='noopener'
will be added to the anchor tag to prevent any potential reverse tabnabbing attack. - onClick
func
Default() => {}specifies the callback function when the link is clicked
- externalLinkAlternativeText
isRequiredIf( PropTypes.string, props => props.target === '_blank', )
Default'in a new tab'specifies the text for links with a
_blank
target (which loads the URL in a new browsing context). - externalLinkTitle
isRequiredIf( PropTypes.string, props => props.target === '_blank', )
Default'Opens in a new tab'specifies the title for links with a
_blank
target (which loads the URL in a new browsing context). - variant
enum
'default' | 'muted' | 'brand'Default'default'type of hyperlink
- isInline
bool
Defaultfalsespecify the link style. By default it will be underlined.
- showLaunchIcon
bool
Defaulttruespecify if we need to show launch Icon. By default it will be visible.
Usage Insights#
Hyperlink
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
edx-platform | 2.6.4 | 2 | |
frontend-app-account | 20.36.0 | 12 | |
frontend-app-admin-portal | 20.26.3 | 21 | |
frontend-app-authn | 20.36.2 | 19 | |
frontend-app-communications | 20.30.1 | 1 | |
frontend-app-course-authoring | 20.32.0 | 8 | |
frontend-app-discussions | 20.15.0 | 3 | |
frontend-app-ecommerce | 20.35.0 | 3 | |
frontend-app-enterprise-public-catalog | 20.29.0 | 2 | |
frontend-app-gradebook | 19.25.4 | 2 | |
frontend-app-learner-dashboard | 20.32.0 | 7 | |
frontend-app-learner-portal-enterprise | 20.36.0 | 21 | |
frontend-app-learner-record | 20.32.0 | 6 | |
frontend-app-learning | 20.28.4 | 25 | |
frontend-app-library-authoring | 20.30.1 | 1 | |
frontend-app-ora-grading | 20.30.0 | 5 | |
frontend-app-payment | 20.30.1 | 7 | |
frontend-app-profile | 20.32.0 | 3 | |
frontend-app-publisher | 20.28.5 | 4 | |
frontend-app-support-tools | 20.26.0 | 8 | |
frontend-lib-content-components | 20.34.0 | 9 | |
frontend-lib-special-exams | 20.22.4 | 4 | |
prospectus | 20.32.3 | 2 | |
studio-frontend | 3.4.8 | 4 |