Skip to content

Button

Trigger an action or follow a link. Labeled and icon-only buttons share a 40px minimum height and a 44px minimum touch target.

Playground

Activated 0 times

Usage

Svelte
<script lang="ts">
  import { Button } from '@allmaps/ui/button'
  import GlobeIcon from 'phosphor-svelte/lib/GlobeIcon'
</script>

<Button>
  {#snippet icon()}<GlobeIcon class="size-5" aria-hidden="true" />{/snippet}
  Open map
</Button>

Examples

Variants
Icon placement
Allmaps logo Modal
States

Props

Prop Values Default
variant default, primary, destructive default
shape rounded, pill rounded
icon Optional Svelte snippet for the icon unset
iconPosition leading or trailing leading
iconOnly Square control; supply an accessible label false
active Visual selection; supply the appropriate ARIA state separately false
disabled Disable activation; links lose their href and leave the tab order false
loading Replace the icon with a spinner, disable activation, and expose aria-busy false
loadingIndicator Optional Svelte snippet for the loading indicator LoadingSmall
href Render a native anchor instead of a button unset
ref Bindable native button or anchor element null
children Button label unset