Hyperlink in Salesforce Lightning Web Component lightning formatted rich text
Oct 9, 2025
Show More Show Less
View Video Transcript
0:04
Hello everyone. In this video we are
0:06
going to see how to have hyperlink in
0:12
Salesforce lightning web component when
0:14
we make use of lightning formatted rich
0:17
text tag. Whenever we use Salesforce
0:20
lightning web components lightning
0:22
formatted rich text tag.
0:25
If I use any text which contains uh URL
0:29
format then it will automatically
0:31
hyperlink. But the problem is we won't
0:35
have
0:37
a a text which will be hyperl for
0:40
example here
0:42
I'm saying visit. So this is uh a link
0:46
to my Salesforce blog for tips. So if I
0:49
click it, it it was able to open my uh
0:52
uh blog.
0:54
But here instead of having the URL I'm
0:57
able to have a text and the text is
0:59
hyperlink hyperl in order to achieve it
1:03
we have to make use of
1:06
anchor tag in the text which is uh
1:10
displayed using lightning formatted rich
1:14
text tag.
1:17
So here
1:20
for the rich text content I'm using rich
1:22
text variable for that I'm and then I'm
1:25
using visit and after that I'm using
1:28
anchor tag so that
1:32
it will open this link when they click
1:37
infallible tech block. So this is the
1:40
text which will be displayed
1:43
and then when they click it, it will
1:45
open the
1:48
blog.
1:50
I'm also using real equal to no opener
1:53
and no referral for security purposes.
1:56
If you wanted to know more about it, you
1:58
can check this blog post. I have given
2:00
the best practices for using uh uh
2:05
attribute as no opener space no refer
2:08
error.
2:14
So make use of anchor tag in the rich
2:17
text content when when you make use of
2:19
Salesforce lightning web component
2:21
lightning formatted rich text so that
2:23
you can achieve hyperlink to the text.
2:30
Please check the video description. In
2:32
the video description, I have shared my
2:34
blog post. From the blog post, you
2:36
should be able to get the sample code
2:39
for your reference.
2:46
I hope it was helpful.
2:53
Thank you for watching.
#Internet Software