Icon Button
Compact button that shows an icon, with an optional text label, in ghost, secondary or primary variants.
<arc-icon-button>Overview
Icon Button is a button whose main content is an icon. Icon-only, it's a circle. Set text and it becomes a small rounded rectangle with an uppercase label beside the icon.
There are three variants: ghost (transparent, the default), secondary (bordered, with a glow on hover) and primary (solid accent fill). Icon-only sizes are xs (28px), sm (32px), md (36px, the default) and lg (44px), and each size has its own padding when there's text.
With href, it renders an <a> in place of a <button>. name picks an icon from arc-icon. For your own SVG, leave name empty and put the SVG in the default slot.
Guidelines
Do
- Give every icon-only button a `label`. Without one, screen readers have nothing to announce
- Use `ghost` for secondary actions in toolbars
- Use `href` for navigation so the button renders a real link
- Use `xs` or `sm` in dense UIs such as table rows
- Pair icon-only buttons with Tooltip so people can see what they do
Don't
- Don't use it for the main action on a page. Use Button
- Don't use long `text`. The uppercase label and tight padding fit one or two words
- Don't put several `primary` icon buttons in one row. Save the solid fill for the most important action
Features
- The icon is 12px at `xs`, 16px at `sm` and `md`, and 20px at `lg`
- Pressing it scales the button to 0.93
- A disabled link drops its `href` and gets `aria-disabled`, so it leaves the tab order
- An `aria-label` set on the host moves to the inner button. If `label` is also set, `label` wins
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<script type="module" src="@arclux/arc-ui"></script>
<!-- Toolbar with mixed variants -->
<div style="display:flex; gap:8px; align-items:center;">
<arc-icon-button name="pencil" label="Edit" variant="ghost"></arc-icon-button>
<arc-icon-button name="copy" label="Duplicate" variant="ghost"></arc-icon-button>
<arc-icon-button name="trash" label="Delete" variant="ghost"></arc-icon-button>
<arc-icon-button name="share" label="Share" variant="secondary"></arc-icon-button>
<arc-icon-button name="plus" text="New Item" variant="primary"></arc-icon-button>
</div>
<!-- Sizes -->
<div style="display:flex; gap:8px; align-items:center; margin-top:16px;">
<arc-icon-button name="star" label="Favorite" size="xs"></arc-icon-button>
<arc-icon-button name="star" label="Favorite" size="sm"></arc-icon-button>
<arc-icon-button name="star" label="Favorite" size="md"></arc-icon-button>
<arc-icon-button name="star" label="Favorite" size="lg"></arc-icon-button>
</div>
<!-- Navigation link -->
<arc-icon-button name="gear" text="Settings" variant="secondary" href="/settings"></arc-icon-button>import { IconButton } from '@arclux/arc-ui-react';
function DocumentToolbar({ onSave, onDelete }) {
return (
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<IconButton name="pencil" label="Edit" />
<IconButton name="copy" label="Duplicate" />
<IconButton name="download" label="Download" variant="secondary" />
<IconButton name="trash" label="Delete" variant="secondary"
onClick={onDelete} />
<IconButton name="floppy-disk" text="Save" variant="primary"
onClick={onSave} />
</div>
);
}
function SocialActions() {
return (
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<IconButton name="heart" label="Like" size="lg" variant="primary" />
<IconButton name="share" label="Share" size="lg" variant="secondary" />
<IconButton name="bookmark" label="Bookmark" size="lg" />
</div>
);
}<script setup>
import { IconButton } from '@arclux/arc-ui-vue';
function handleEdit() { console.log('Editing...'); }
function handleDelete() { console.log('Deleting...'); }
</script>
<template>
<!-- Card action bar -->
<div style="display:flex; gap:8px; align-items:center;">
<IconButton name="pencil" label="Edit" @click="handleEdit" />
<IconButton name="copy" label="Duplicate" variant="ghost" />
<IconButton name="trash" label="Delete" variant="secondary" @click="handleDelete" />
</div>
<!-- With text labels for clarity -->
<div style="display:flex; gap:8px; align-items:center; margin-top:16px;">
<IconButton name="download" text="Export" variant="secondary" />
<IconButton name="share" text="Share" variant="ghost" />
<IconButton name="plus" text="Add" variant="primary" />
</div>
</template><script>
import { IconButton } from '@arclux/arc-ui-svelte';
let liked = false;
</script>
<!-- Toggle-style icon button -->
<IconButton
name={liked ? 'heart-fill' : 'heart'}
label={liked ? 'Unlike' : 'Like'}
variant={liked ? 'primary' : 'ghost'}
on:click={() => liked = !liked}
/>
<!-- Compact toolbar -->
<div style="display:flex; gap:4px;">
<IconButton name="pencil" label="Edit" size="sm" />
<IconButton name="copy" label="Copy" size="sm" />
<IconButton name="link" label="Copy Link" size="sm" />
<IconButton name="trash" label="Delete" size="sm" variant="secondary" />
</div>import { Component } from '@angular/core';
import { IconButton } from '@arclux/arc-ui-angular';
@Component({
imports: [IconButton],
template: `
<div style="display:flex; gap:8px; align-items:center;">
<arc-icon-button name="pencil" label="Edit" (click)="onEdit()"></arc-icon-button>
<arc-icon-button name="copy" label="Duplicate" variant="ghost"></arc-icon-button>
<arc-icon-button name="trash" label="Delete" variant="secondary" (click)="onDelete()"></arc-icon-button>
<arc-icon-button name="plus" text="New Item" variant="primary" (click)="onCreate()"></arc-icon-button>
</div>
<!-- Navigation links -->
<div style="display:flex; gap:8px; margin-top:16px;">
<arc-icon-button name="gear" text="Settings" variant="secondary" href="/settings"></arc-icon-button>
<arc-icon-button name="bell" text="Notifications" variant="ghost" href="/notifications"></arc-icon-button>
</div>
`,
})
export class ToolbarComponent {
onEdit() { console.log('Edit'); }
onDelete() { console.log('Delete'); }
onCreate() { console.log('Create'); }
}import { IconButton } from '@arclux/arc-ui-solid';
function TableRowActions(props: { onEdit: () => void; onDelete: () => void }) {
return (
<div style={{ display: 'flex', gap: '4px' }}>
<IconButton name="pencil" label="Edit" size="xs" onClick={props.onEdit} />
<IconButton name="copy" label="Duplicate" size="xs" />
<IconButton name="trash" label="Delete" size="xs" variant="secondary" onClick={props.onDelete} />
</div>
);
}
function PageHeader() {
return (
<div style={{ display: 'flex', gap: '8px', 'align-items': 'center' }}>
<IconButton name="arrow-left" label="Back" href="/" />
<IconButton name="share" text="Share" variant="secondary" />
<IconButton name="download" text="Export" variant="primary" />
</div>
);
}import { IconButton } from '@arclux/arc-ui-preact';
function MediaControls() {
return (
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<IconButton name="skip-back" label="Previous" size="sm" />
<IconButton name="play" label="Play" variant="primary" size="lg" />
<IconButton name="skip-forward" label="Next" size="sm" />
<IconButton name="speaker-high" label="Volume" size="sm" variant="ghost" />
<IconButton name="heart" label="Favorite" size="sm" />
</div>
);
}<!-- arc-icon-button is interactive — requires JS -->
<arc-icon-button></arc-icon-button><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-icon-button — requires icon-button.css + tokens.css (or arc-ui.css) -->
<span class="arc-icon-button">
<a href="#" aria-label="Label"></a>
</span>API
namestring''- Name of the arc-icon to render. When empty, the default slot is used for custom icon content.
textstring''- Optional text label displayed next to the icon. When provided, the button expands from a square to a wider labeled button with uppercase styling.
labelstring''- Accessible label for the button. Falls back to
textif not provided. Required for icon-only usage. hrefstring''- When set, renders the button as an anchor tag for navigation links.
typestring'button'- HTML button type attribute. Only applies when
hrefis not set. variant'ghost' | 'secondary' | 'primary''ghost'- Visual style variant. Ghost is transparent, secondary has a border with glow, primary has a solid accent-primary fill.
size'xs' | 'sm' | 'md' | 'lg''md'- Button size controlling dimensions and icon scale. Icon-only sizes are circular: xs=28px, sm=32px, md=36px, lg=44px. The labeled form stays a rounded rectangle.
disabledbooleanfalse- Disables the button, reducing opacity to 40% and blocking pointer events.
See also
- ButtonAction button with three variants for action hierarchy and prefix and suffix slots for icons. For links, slot a real anchor, which works before JavaScript loads.
- Copy ButtonA button that copies a string to the clipboard and shows "Copied!" when the copy works.
- TooltipA short text hint shown next to a control on hover or keyboard focus.