Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rmwc/icon-button

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/icon-button

RMWC IconButton component

  • 5.0.0-alpha.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5K
decreased by-22.53%
Maintainers
1
Weekly downloads
 
Created
Source

Icon Buttons

Icon buttons allow users to take actions, and make choices, with a single tap.

  • Module @rmwc/icon-button
  • Import styles:
    • import '@material/icon-button/dist/mdc.icon-button.css';
  • MDC Docs: https://material.io/develop/web/components/buttons/icon-buttons/

Basic Usage

IconButton inherits from the Icon component and can be passed icons in the same way.

import { IconButton } from '@rmwc/icon-button';

<IconButton icon="star" label="Rate this!" />
<IconButton
  icon="https://www2.le.ac.uk/departments/law/images/twitter-follow-us-icon"
  aria-label="Tweet it!"
/>

Usage as a Toggle

To use as a toggle, specify an additional toggled on state using 'onIcon'.

{/* Uncontrolled */}
<IconButton
  icon="favorite_border"
  onIcon="favorite"
/>

{/* Controlled */}
<IconButton
  checked={this.state.isChecked}
  onClick={() => this.setState({isChecked: !this.state.isChecked})}
  onIcon="star"
  icon="star_border"
/>

<IconButton
  onChange={(evt) => console.log(evt.detail)}
  onIcon="https://www2.le.ac.uk/departments/law/images/twitter-follow-us-icon"
  icon="https://en.facebookbrand.com/wp-content/uploads/2016/05/flogo_rgb_hex-brc-site-250.png"
/>

<IconButton
  onIcon={
    <div style={{ background: 'red', width: '24px', height: '24px'}} />
  }
  icon={
    <div style={{ background: 'green', width: '24px', height: '24px', borderRadius: '50%' }} />
  }
/>
import { Docs } from '@rmwc/base/utils/document-component';
import * as docs from './docgen.json';

<Docs src={docs} components={['IconButton']} />

Keywords

FAQs

Package last updated on 29 Jan 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc