frame

ButtonMachine

A button drawn as a dashed frame with the label set in a block of the current accent. The label turns black or white to stay readable on whatever the accent is. Pass `href` and it renders a link.

Install

pnpm add @fractaldesign/machines-ui
import '@fractaldesign/machines-ui/style.css';
import { ButtonMachine } from '@fractaldesign/machines-ui';

Preview

<ButtonMachine onclick={() => console.log('run')}>Run</ButtonMachine>
<ButtonMachine href="/docs">Docs</ButtonMachine>
<ButtonMachine disabled>Button</ButtonMachine>

Props

PropTypeDefaultDescription
href string —Makes it a link: an `<a>` with this address instead of a `<button>`.
type 'button' | 'submit' | 'reset' 'button'The `type` of the `<button>`. Not used when `href` is set. Default 'button'.
disabled boolean falseDisables the `<button>`. Not used when `href` is set. Default false.
onclick (event: MouseEvent) => void —Called when the button or link is clicked.
class string ''Extra classes on the outer element.

API

  • snippet children The label.
  • class forwarded to the outer element

src/lib/components/frame/ButtonMachine.svelte

machines-ui