Skip to content

StandardButton

import { StandardButton, VerticalBox } from "std-widgets.slint";
export component Example inherits Window {
VerticalBox {
StandardButton { kind: ok; }
StandardButton { kind: apply; }
StandardButton { kind: cancel; }
}
}
slint
std-widgets standardbutton example

The StandardButton looks like a button, but instead of customizing with text and icon, it can used one of the pre-defined kind and the text and icon will depend on the style.

Properties

enabled

bool default: false

Defaults to true. When false, the button can’t be pressed

has-focus

bool (out) default: false

Set to true when the button currently has the focus

kind

enum StandardButtonKind default: the first enum value

StandardButtonKind

Use this enum to add standard buttons to a Dialog. The look and positioning of these StandardButtons depends on the environment (OS, UI environment, etc.) the application runs in.

  • ok: A “OK” button that accepts a Dialog, closing it when clicked.
  • cancel: A “Cancel” button that rejects a Dialog, closing it when clicked.
  • apply: A “Apply” button that should accept values from a Dialog without closing it.
  • close: A “Close” button, which should close a Dialog without looking at values.
  • reset: A “Reset” button, which should reset the Dialog to its initial state.
  • help: A “Help” button, which should bring up context related documentation when clicked.
  • yes: A “Yes” button, used to confirm an action.
  • no: A “No” button, used to deny an action.
  • abort: A “Abort” button, used to abort an action.
  • retry: A “Retry” button, used to retry a failed action.
  • ignore: A “Ignore” button, used to ignore a failed action.

The kind of button, one of ok cancel, apply, close, reset, help, yes, no, abort, retry or ignore

StandardButton {
kind: ok;
}
slint

pressed

bool (out) default: false

Set to true when the button is pressed.

Callbacks

clicked()

Invoked when clicked: A finger or the left mouse button is pressed, then released on this element.

StandardButton {
clicked() => {
debug("Button clicked");
}
}
slint

© 2024 SixtyFPS GmbH