qat

Button

Button. It is copied into your app’s ui/ by qatjs add button: the code is yours to edit.

Example

Example.qx29 lines, 1 reactive nameOpen in the playground
import Button from './ui/button/button.qx'

export default function Example() {
  let saving = state(false)
  const save = () => {
    saving = true
    setTimeout(() => (saving = false), 1200)
  }
  return (
    <div class="example-row">
      <Button variant="primary" loading={saving} on:click={save}>
        {saving ? 'Saving' : 'Save order'}
      </Button>
      <Button>Preview</Button>
      <Button variant="tertiary">
        Cancel
      </Button>
      <Button variant="danger">
        Cancel order
      </Button>
      <Button size="sm">
        Small
      </Button>
      <Button disabled>
        Disabled
      </Button>
    </div>
  )
}
saving state

Add it

shell1 line
npx qatjs add button

Button

As a custom element: <ui-button>.

Button: props
PropTypeAttribute
variant'primary' | 'secondary' | 'tertiary' | 'danger' | 'danger-tertiary'yes
size'sm' | 'md' | 'lg'yes
type'button' | 'submit' | 'reset'yes
loadingbooleanyes
disabledbooleanyes
labelstringyes
iconQatNodeproperty only
iconEndQatNodeproperty only

Keys

KeyDoes
Enter, Spaceactivate (held back while loading)