Button
A light touch, an instant response. Triggers actions and state changes.
Basic usage
Live preview
Clicks: 0
View Vue source
Vue · TypeScript
<script setup lang="ts">
import { AgmButton, AgmHudStatus } from 'augma'
import { shallowRef } from 'vue'
const count = shallowRef(0)
</script>
<template>
<div class="example-demo">
<div class="example-row">
<AgmButton @click="count++">Connect device</AgmButton>
<AgmButton variant="outline" @click="count++">Secondary action</AgmButton>
<AgmButton variant="ghost" @click="count++">Subtle action</AgmButton>
<AgmButton variant="glass" @click="count++">Glass action</AgmButton>
<AgmButton variant="danger" @click="count++">Danger action</AgmButton>
<AgmButton loading>Loading</AgmButton>
<AgmButton disabled>Unavailable</AgmButton>
</div>
<AgmHudStatus :tone="count ? 'success' : 'neutral'">
Clicks: <strong class="example-count">{{ count }}</strong>
</AgmHudStatus>
</div>
</template>
<style scoped>
.example-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 16px;
}
.example-stack {
display: grid;
gap: 24px;
width: 100%;
max-width: 360px;
}
/* The readout sits on its own line, so the button row never moves as the count grows. */
.example-demo {
display: grid;
justify-items: start;
gap: 20px;
}
.example-count {
color: var(--agm-text);
font-variant-numeric: tabular-nums;
}
</style>
API
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'primary' | 'outline' | 'ghost' | 'glass' | 'danger' | 'primary' | Visual emphasis (primary / outline / ghost / glass / danger) |
size | 'sm' | 'md' | 'lg' | 'md' | Button size |
disabled | boolean | false | Blocks interaction |
loading | boolean | false | Shows work in progress and blocks repeated actions |
type | 'button' | 'submit' | 'reset' | 'button' | Native button type |
Slots
- default: button text
Keyboard and usage notes
Tab to focus; Enter or Space to activate. Loading and disabled buttons ignore input.
Installation
ts
import { AgmButton } from 'augma'
import 'augma/style.css'Copy the editable source:
sh
pnpm dlx [email protected] add https://augma.yyj.moe/r/button.json