Skip to content

GkButton

<button> or <a> (when href is set) with God Kit styling: primary, secondary, ghost, and danger variants, sm / md sizes, optional loading, readonly, slim, stacked, and prepend / append / loader slots.

When to use

Use for actions in forms, dialogs, and toolbars. Prefer type="submit" inside forms and type="button" for standalone actions. For navigation to a URL, pass href (renders an anchor with the same styles). Router-aware navigation (to) belongs in the app (e.g. NuxtLink wrapping GkButton or a small app wrapper).

Live demo

Basic

Advanced / edge case

Link

API

Props

PropTypeDefaultDescription
type'button' | 'submit' | 'reset''button'HTML button type (ignored when href is set)
variant'primary' | 'secondary' | 'ghost' | 'danger''primary'Visual style
size'sm' | 'md''md'Padding and font size
disabledbooleanfalseDisables the control
blockbooleanfalseFull width
loadingbooleanfalseLoading overlay, blocks clicks, sets aria-busy
readonlybooleanfalseBlocks clicks without disabled styling; sets aria-disabled
slimbooleanfalseTighter padding
stackedbooleanfalseColumn layout for icon + label
hrefstringIf set, renders <a> instead of <button>
relstringLink rel (defaults to noopener noreferrer when target="_blank")
targetstringLink target
downloadboolean | stringAnchor download attribute
loadingLabelstringPassed to the default GkSpinner in the loader slot

Events

EventPayloadDescription
clickMouseEventFired when the action is not blocked (disabled, readonly, or loading swallow the event)

Slots

SlotDescription
defaultLabel
prependLeading content (e.g. icon)
appendTrailing content
loaderReplaces default GkSpinner when loading is true

Examples

Variants

vue
<script setup lang="ts">
import { GkButton } from 'god-kit/vue'
</script>

<template>
  <GkButton variant="primary">Save</GkButton>
  <GkButton variant="secondary">Cancel</GkButton>
  <GkButton variant="ghost">Skip</GkButton>
  <GkButton variant="danger">Delete</GkButton>
</template>
vue
<GkButton :loading="saving" @click="save">Save</GkButton>
<GkButton href="/docs" variant="ghost">Docs</GkButton>

Accessibility notes

  • Keep visible text in the default slot for clear action names.
  • Use loadingLabel when your loading state needs a more specific spoken label.
  • Prefer disabled for unavailable actions and readonly only when the action should remain visually active but non-interactive.

Released under the MIT License.