MButton <m-button>
A button that reacts like an anime impact frame. Press and it squashes flat; let go and it inverts for one frame, a burst goes off behind it, clouds roll off the corners and ドン! lands. Call done() to land a check on it. The secondary variant is a small squash and three wedges.
Demo source
vue
<script setup lang="ts">
import { useTemplateRef } from 'vue';
import { MButton, type ButtonExpose } from 'vue-manga-ui';
const save = useTemplateRef<ButtonExpose>('save');
function onSave(): void {
// pretend the request worked
setTimeout(() => save.value?.done(), 400);
}
</script>
<template>
<div class="row">
<MButton ref="save" @click="onSave">Confirm</MButton>
<MButton variant="secondary">Cancel</MButton>
</div>
</template>Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'secondary' | "primary" | primary throws the full impact; secondary is the quiet one. |
disabled | boolean | false | Disables the button: no press, no effects. |
type | 'button' | 'submit' | 'reset' | "button" | Native button type. |
Other HTML attributes (id, class, aria-*, data-*…) fall through to the component’s element and are type-checked.
Slots
| Slot | Props | Description |
|---|---|---|
default | any | Button label. |
Exposed (via template ref)
| Method | Signature | Description |
|---|---|---|
impact | () => void | The impact a click throws. You can call it yourself. |
done | (hold?: number) => void | Land a check on the button with a glint. It goes after hold seconds (0 keeps it). |