Skip to content

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 ​

PropTypeDefaultDescription
variant'primary' | 'secondary'"primary"primary throws the full impact; secondary is the quiet one.
disabledbooleanfalseDisables 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 ​

SlotPropsDescription
defaultanyButton label.

Exposed (via template ref) ​

MethodSignatureDescription
impact() => voidThe impact a click throws. You can call it yourself.
done(hold?: number) => voidLand a check on the button with a glint. It goes after hold seconds (0 keeps it).