Button
Button. It is copied into your app’s ui/ by qatjs add button: the code is yours to edit.
Example
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 stateAdd it
npx qatjs add buttonButton
As a custom element: <ui-button>.
| Prop | Type | Attribute |
|---|---|---|
variant | 'primary' | 'secondary' | 'tertiary' | 'danger' | 'danger-tertiary' | yes |
size | 'sm' | 'md' | 'lg' | yes |
type | 'button' | 'submit' | 'reset' | yes |
loading | boolean | yes |
disabled | boolean | yes |
label | string | yes |
icon | QatNode | property only |
iconEnd | QatNode | property only |
Keys
| Key | Does |
|---|---|
| Enter, Space | activate (held back while loading) |