Gizem Deniz
Gizem Deniz

Reputation: 21

How can I add href to Icon for Ant Design?

How can I add an Url link to the icon?


  <Space>
       <a href={team.github}>
          <GithubOutlined className="teamSocialIcon" />
       </a>
       <a href={team.linkedin}>
          <LinkedinFilled className="teamSocialIcon" />
       </a>
    </Space>

Upvotes: 1

Views: 11550

Answers (2)

Arifur Rahman Munna
Arifur Rahman Munna

Reputation: 31

You can use Button component of Ant Design and change the type to "link".

<Button type="link" href="url://" icon={<Your Icon/>} />

Upvotes: 1

Yor
Yor

Reputation: 182

You can use Button component of Ant Design and change the type to "text" or "link".

<Button type="text" href={team.github}>
  <GithubOutlined className="teamSocialIcon" />
</Button>

or

<Button type="text" href={team.github} icon={<GithubOutlined className="teamSocialIcon" />} />

But I usually create a component with these two combined to add more custom functionality.

Upvotes: 3

Related Questions