Skip to content

Button

Trigger an action or navigate to another page.

Demos

Size
Variant

Usage

Import Button from its local folder after installation.

vue
<script setup lang="ts">
import { Button } from '~/components/ui/button'
</script>

<template>
  <Button @click="createProject">Create project</Button>
</template>

Variants

Choose solid, soft, subtle, outline, ghost, or link. Primary and accent solid buttons use the tactile material. Secondary and semantic solid buttons use flat fills.

vue
import tailwindcss from '@tailwindcss/vite'

export default defineNuxtConfig({
  modules: ['akaza-ui/nuxt', '@nuxt/fonts', '@nuxtjs/color-mode'],
  css: ['~/assets/main.css'],
  colorMode: { classSuffix: '', preference: 'system', fallback: 'light' },
  vite: { plugins: [tailwindcss()] },
})

Colors

Choose primary, secondary, accent, info, success, warning, or destructive. Accent defaults to blue and remains separate from primary and secondary. Soft, subtle, outline, and ghost use matching emphasis text, tints, and borders as defined in Action colors. Use the preview controls to inspect each color with each variant.

vue
<Calendar v-model="dates" selection-mode="range" range-color="accent" />
<DateRangePicker v-model="dates" range-color="secondary" />
<MonthRangePicker v-model="months" range-color="accent" />
<YearRangePicker v-model="years" range-color="secondary" />

Sizes

Each size changes the control geometry, typography, padding, radius, icon size, and gap. Values below use a 16px browser root and the default 10px radius token. The shared geometry profiles define the control scale.

On coarse-pointer devices, buttons have a 44px minimum height and width for touch interaction.

xs
sm
md
lg
xl
SizeHeightPadding X / YText / line heightRadiusIconGap
xs24px8px / 2px12px / 16px5px12px4px
sm28px10px / 4px13px / 16px6px14px4px
md32px12px / 4px14px / 20px8px16px6px
lg36px14px / 6px14px / 20px10px18px8px
xl40px16px / 6px16px / 24px12px20px10px

Icon buttons

Use shape="icon" with any size. The width matches the height and horizontal padding becomes zero. Give the button an accessible name with aria-label.

Disabled and loading

Use disabled to block an action and loading to control a pending state. With loading-auto, return a Promise from the click handler. Akaza blocks duplicate activation until that Promise settles.

The default loading slot keeps the label's width and overlays the spinner. Provide #loading to replace the indicator. This demo waits one second; it does not send data.

The async demo waits one second.
vue
<Button loading-auto @click="saveChanges">Save changes</Button>

Overrides

Use class for the root and ui for root, content, spinner, or loadingText. Consumer classes take priority through cn.

Pass as="a" and href to use Akaza's alternate root. For Nuxt routing, pass the resolved NuxtLink component through as. Akaza gives alternate roots button keyboard behavior, including Space activation.

Installation

Complete the shared installation. Copy Button.vue and index.ts into app/components/ui/button/.

API

Props

PropValuesFallback
colorprimary, secondary, accent, info, success, warning, destructiveprimary
variantsolid, soft, subtle, outline, ghost, linksolid
sizexs, sm, md, lg, xlsm
shapedefault, icondefault
asHTML tag or Vue componentbutton
typebutton, submit, resetbutton
disabledbooleanfalse
loadingbooleanfalse
loadingAutobooleanfalse
focusableWhenDisabledbooleanfalse
uiClasses for root, content, spinner, loadingTextnone

Use the default slot for content and #loading for custom loading content. Native attributes and event handlers pass through to Akaza's root. Akaza owns keyboard activation, loading state, and disabled behavior.