Android — Material 3
JS behaviour
Material buttons
The five core Material 3 buttons — filled, tonal, outlined, text and elevated — with a real ripple boiling from the touch point, full rounding, 40px height and the official disabled opacities.
Real scenarios
The component as it is used in a product — not a specimen grid.
Five buttons, one ripple
Tap anywhere on a button — the ripple boils from your finger and fades in 500 ms. Focus one and press Enter to see it rise from the centre.
Nabu Music
Sync your library across devices
The whole family
All at 40 px tall, fully rounded, with the official disabled tokens — label at 38% and surface at 12% of the colour.
filled
tonal
elevated
outlined
text
standard
filled
tonal
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| --m3btn-primary | color | '#6750A4' | The primary colour; on Material’s dark theme it becomes #D0BCFF. |
| --m3btn-radius | length | '999px' | Corner radius; M3 wants buttons fully rounded. |
| ripple | event | 'pointerdown' | The ripple boils from the pointer coordinates and fades in 500ms; from centre on keyboard. |
| disabled | opacity | '38% · 12%' | Label at 38% and surface at 12% of colour, exactly per the Material tokens. |
Snippet
<button class="m3btn" data-variant="filled" onpointerdown="m3Ripple(event)">ورود</button>
<button class="m3btn" data-variant="tonal">ذخیره پیشنویس</button>
<button class="m3btn" data-variant="outlined">بعداً</button>
<button class="m3btn" data-variant="text">رد کردن</button>
<button class="m3btn" data-variant="elevated">بالا بردن</button>
<style>
.m3btn { position: relative; overflow: hidden; block-size: 40px; padding-inline: 24px;
border-radius: 999px; font: 500 14px Roboto, system-ui; }
.m3btn[data-variant='filled'] { background: var(--m3btn-primary); color: #fff; }
.m3btn .m3btn-ripple { position: absolute; border-radius: 50%; translate: -50% -50%;
background: currentColor; opacity: .12; animation: m3btn-ripple .5s ease-out forwards; }
</style>