Icon buttons are symbolic buttons or toggles.
npm install --save-dev @smui/icon-button
The latest SMUI v3 had a lot of changes, and these docs haven't been caught up yet. You should check out the demo page's code to see the latest usage.
<IconButton class="material-icons" on:click={doSomething}>build</IconButton>
<IconButton toggle bind:pressed={starred}>
<Icon class="material-icons" on>star</Icon>
<Icon class="material-icons">star_border</Icon>
</IconButton>
<script>
import IconButton, { Icon } from '@smui/icon-button';
let starred = false;
function doSomething() {
alert('something');
}
</script>
An icon button.
use
:[]
- An array of Svelte actions and/or arrays of an action and its options.class
:''
- A CSS class string.ripple
:true
- Whether to implement a ripple for when the component is interacted with.color
:null
- A color passed to the ripple action.toggle
:false
- Whether the button is a toggle. A toggle button should have twoIcon
children, one with theon
prop.pressed
:false
- Whether the toggle button is pressed.href
:null
- A hyperlink ref attribute. If this is present, the icon button will use ana
element instead of abutton
element.action
:null
- Used in the context of a data table pagination. This sets the button's action. ('first-page', 'prev-page', 'next-page', or 'last-page')
MDCIconButtonToggle:change
A graphic icon.
See the common icon readme.
See Icon Button in MDC-Web for information about the upstream library's architecture.