Icon Button

Alignment target:@astryxdesign/core v0.7.1 · IconButton

Usage #

IconButton displays one icon. The icon must clearly identify the action. Set label to provide an accessible name:

Vue
<script setup lang="ts">
import { Icon } from '@astryx-vue/core/Icon'
import { IconButton } from '@astryx-vue/core/IconButton'
</script>

<template>
  <IconButton label="Search">
    <Icon name="carbon:search" />
  </IconButton>
</template>

Icon fills the square the button already sizes. Leave size unset. A CSS icon class still works in the slot when your build generates it; UnoCSS is not required.

Use a text-bearing Button when the action is not immediately clear.

Best practices #

GuidancePractices
DoMake the aria-label specific: a trash icon labeled "Delete conversation" is clearer than just "Delete" for screen readers.
DoAdd a tooltip: even a gear icon can mean Settings, Preferences, or Configure.
DoUse ghost in toolbars and dense areas to reduce visual clutter.
Don'tUse IconButton if the action isn't obvious from the icon alone; use Button with text.
Don'tSkip the tooltip; label only reaches screen readers, sighted users need the hover hint.

Examples #

Icon Button — Action bar

Open in Playground

Row of ghost icon buttons for a compact action toolbar.

Icon Button — Floating

FABs are usually icon-only — raise one with `elevation="high"`
Open in Playground

A floating action button. The most common floating-button shape is icon-only. Raised here with elevation="high".

Icon Button — Loading state

Open in Playground

Icon buttons that show a loading spinner on click for async feedback.

Icon Button — With tooltips

Open in Playground

Icon buttons with tooltips that explain each action on hover.