Switch
Instantly toggles a clear on/off state.
Basic usage
View Vue source
<script setup lang="ts">
import { AgmSwitch } from 'augma'
import { shallowRef } from 'vue'
const enabled = shallowRef(true)
</script>
<template>
<div class="example-stack">
<AgmSwitch v-model="enabled" label="Show HUD" />
<output>{{ enabled ? 'HUD on' : 'HUD off' }}</output>
<AgmSwitch label="Unavailable switch" disabled />
</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;
}
</style>
API
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | boolean | false | Updated through v-model |
label | string | Required | Visible label |
disabled | boolean | false | Blocks toggling |
name | string | undefined | Form field name |
Events
update:modelValue(boolean)
Keyboard and usage notes
Tab to focus; Space or Enter to toggle.
Installation
ts
import { AgmSwitch } from 'augma'
import 'augma/style.css'