Skip to main content
Urbicon UI

Button

The control that triggers an action.

Playground

Variant Style variant
Tier Style variant
Loading Placement
<Button
  intent="primary"
  loadingPlacement="overlay"
  mint="scale"
  size="lg"
>
  Get Started
</Button>

01 Examples

Toggle buttons

active marks a button as selected or on and sets aria-pressed for you. Reach for it when the choice persists, like a formatting toggle that stays lit. pressed is its momentary cousin for a press-and-release cue. Both are booleans you drive from your own state.
{#each formats as fmt (fmt.name)}
  <Button variant="ghost" intent="primary" active={fmt.on} onclick={() => (fmt.on = !fmt.on)}>
    {fmt.name}
  </Button>
{/each}

Icons and labels

Put an icon in the button's content, before or after the label. The gap between icon and label comes from the button's size, so it tracks the button, while the glyph keeps whatever size you set on the icon (size={18} here).
<Button intent="primary"><PlusIcon size={18} />New project</Button>
<Button variant="outlined" intent="neutral"><DownloadIcon size={18} />Export</Button>
<Button variant="text" intent="primary">Continue<ArrowRightIcon size={18} /></Button>

Submit with a loading state

Flip loading while a request is in flight. The button blocks activation but stays focusable, so the action can't double-fire. loadingPlacement=start keeps the label beside the spinner, where the default overlay hides it behind the spinner instead.
<Button intent="primary" loading={saving} loadingPlacement="start" onclick={save}>
  {saving ? 'Saving…' : 'Save changes'}
</Button>

Composing micro-interactions

mint layers motion feedback: pass an array to stack effects, or an object to tune a duration. The Playground's Mint control picks one effect at a time, so arrays and per-effect config appear only here. Nine effects ship. Six are held on hover (scale, translate, rotate, glow, pulse, wiggle) and three fire on click (ripple, bounce, shake).
<Button intent="primary" mint={['scale', 'ripple']}>Scale + Ripple</Button>
<Button intent="success" mint={['glow', 'bounce']}>Glow + Bounce</Button>
<Button intent="warning" mint={[{ name: 'glow', config: { duration: 500 } }]}
  >Slow Glow</Button
>

03 Customization

Neon outline

One class gives the button a neon outline glowing on a dark panel. It keeps the button's radius tier, padding and press behaviour, and only the border, text and glow are raw. The colours are raw because a neon hue has no token equivalent.
<Button
  class="border border-emerald-400 bg-transparent text-emerald-400 shadow-[0_0_15px_rgba(52,211,153,0.3)] hover:bg-emerald-400/10 hover:shadow-[0_0_25px_rgba(52,211,153,0.5)]"
>
  Deploy
</Button>
<Button
  class="border border-sky-400 bg-transparent text-sky-400 shadow-[0_0_15px_rgba(56,189,248,0.3)] hover:bg-sky-400/10 hover:shadow-[0_0_25px_rgba(56,189,248,0.5)]"
>
  Preview
</Button>

This is one of five ways to restyle a block. See Customization for class, slotClasses, unstyled, preset and provider-level overrides.

04 Accessibility

Built-in ARIA

The button manages aria-pressed for toggle and selected states, aria-busy while loading, and aria-disabled when disabled. Focus indication uses focus-visible, so the ring appears only for keyboard focus.

Keyboard

Tab moves focus. Enter / Space activate. While loading, the button ignores activation but stays focusable.

Reduced motion

Mint effects respect prefers-reduced-motion: with it enabled, the hover and click animations are suppressed and the ripple is never drawn.

05 API Reference

20 props
20 props
Prop
Type
Default
Description

06 Types

Local type definitions used by this component.

7 types
Name
Kind
Category
Used by
Description

07 Installation

Import

import { Button } from '@urbicon-ui/blocks';