Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@material/react-icon-button
Advanced tools
A React version of an MDC Icon Button.
npm install @material/react-icon-button
with Sass:
import '@material/react-icon-button/index.scss';
with CSS:
import '@material/react-icon-button/dist/icon-button.css';
import React from 'react';
import IconButton from '@material/react-icon-button';
import MaterialIcon from '@material/react-material-icon';
class MyApp extends React.Component {
render() {
return (
<IconButton>
<MaterialIcon icon='favorite' />
</IconButton>
);
}
}
You can use any other icon here such as Font Awesome, which is documented more in detail here. If you're using Google Font's Material Icons, we recommend using our Material Icon Component as shown in the example above.
If you need to use this component as an Icon Button Toggle, please read this documentation. The following is an example using the <IconToggle />
component as children of <IconButton>
. One component with the isOn
prop, and one without.
import React from 'react';
import IconButton, {IconToggle} from '@material/react-icon-button';
import MaterialIcon from '@material/react-material-icon';
class MyApp extends React.Component {
render() {
return (
<IconButton>
<IconToggle isOn>
<MaterialIcon icon='favorite' />
</IconToggle>
<IconToggle>
<MaterialIcon icon='favorite_border' />
</IconToggle>
</IconButton>
);
}
}
Prop Name | Type | Description |
---|---|---|
children | Element | Icon element or text to be displayed within root element. |
className | String | Classes to be applied to the root element. |
disabled | Boolean | Disables button if true. |
isLink | Boolean | Changes root element to an anchor tag (default button). |
onClick | Function | Click event handler. Event is passed as an argument |
Sass mixins may be available to customize various aspects of the Components. Please refer to the MDC Web repository for more information on what mixins are available, and how to use them.
FAQs
Material Components React Icon Button
The npm package @material/react-icon-button receives a total of 258 weekly downloads. As such, @material/react-icon-button popularity was classified as not popular.
We found that @material/react-icon-button demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.