I have this Icon from material UI, I wish to make it clickable and open a new window to www.linkedin.com
should I use href="Linkedin.com" ? or add onClick ? I wish it to open a new tab/window aswell
I have this Icon from material UI, I wish to make it clickable and open a new window to www.linkedin.com
should I use href="Linkedin.com" ? or add onClick ? I wish it to open a new tab/window aswell
This should do using Material-UI Icons:
import LinkedInIcon from '@material-ui/icons/LinkedIn';
import IconButton from '@material-ui/core/IconButton';
<IconButton aria-label="Linkedin.com" onClick={() => window.open('https://www.Linkedin.com')}>
<LinkedInIcon fontSize="large" />
</IconButton>
To open a new page:
onClick={() => window.open(newPageUrl, "_blank")}
To open on the same one:
onClick={() => window.location.replace(newPageUrl)}
there is two way which can help you
you can use href
on Button
or IconButton
import { Icon, IconButton } from "@mui/material";
<IconButton href={app.url} aria-label="launch" color="primary" target="_blank">
<Icon baseClassName="material-icons" >launch</Icon>
</IconButton>