Phoundry UI

Button

Versatile button with multiple variants, sizes, icon support, loading state, and automatic tooltip integration.

import { Button } from 'phoundry-ui';

Variants

Show code
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="danger">Danger</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>

Sizes

Show code
<Button size="xs">Extra Small</Button>
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>

With Icons

Show code
<Button icon={PhiIcons.add} variant="primary">Add Item</Button>
<Button icon={PhiIcons.edit} iconPosition="right">Settings</Button>
<Button icon={PhiIcons.close} iconOnly title="Close" />

States

Show code
<Button loading>Saving...</Button>
<Button active>Active</Button>
<Button disabled>Disabled</Button>

Full width

Show code
<div class="w-64">
	<Button variant="primary" fullWidth>Continue</Button>
</div>

As Link

Show code
<Button href="https://example.com" target="_blank" variant="link">External Link</Button>

Props

PropTypeDefaultDescription
variant 'primary' | 'secondary' | 'outline' | 'danger' | 'ghost' | 'link''secondary'Visual style of the button.
size 'xs' | 'sm' | 'md' | 'lg''md'Canonical control scale — heights, typography, padding, and icon px shared via controlSizes.
icon stringIconify icon string shown alongside or instead of text.
iconPosition 'left' | 'right''left'Which side to place the icon on.
iconOnly booleanfalseRender only the icon with square padding. Use with title for accessibility.
loading booleanfalseShow a spinner and disable interaction.
active booleanfalseHighlight the button as currently active/selected.
disabled booleanfalseDisable the button.
class stringAdditional CSS classes merged onto the outer interactive element.
element HTMLButtonElement | HTMLAnchorElementBindable reference to the underlying button or anchor.
href stringWhen provided, renders an <a> tag instead of <button>.
target stringLink target when using href (e.g. _blank).
rel stringOptional link rel; defaults to noopener noreferrer when target is _blank.
title stringTooltip text (uses the phoundry-ui tooltip system by default).
noTooltip booleanfalseUse native title attribute instead of tooltip system.
fullWidth booleanfalseStretch the button to the width of its parent.
onclick (e: MouseEvent) => voidClick handler.
children SnippetButton label content.
...rest HTMLButtonAttributesOther native attributes (type, aria-*, data-*, keyboard handlers, etc.) are forwarded to the DOM element.

Usage tips

  • Use iconOnly with a title prop for accessible icon buttons — the tooltip appears automatically.
  • Set noTooltip to use the native browser title attribute instead of the phoundry-ui tooltip system.
  • The link variant removes height and padding — it renders inline like a text link.
  • ButtonGroup renders text-only segments inside an inset, rounded shell; use Button elsewhere for icons, variants, or links.