Button#

A simple button. Common types of buttons can also be created with StandardButton.

Properties#

  • checkable (in bool): Shows whether the button can be checked or not. This enables the checked property to possibly become true.

  • checked (inout bool): Shows whether the button is checked or not. Needs checkable to be true to work.

  • enabled: (in bool): Defaults to true. When false, the button cannot be pressed

  • has-focus: (out bool): Set to true when the button has keyboard focus.

  • icon (in image): The image to show in the button. Note that not all styles support drawing icons.

  • pressed: (out bool): Set to true when the button is pressed.

  • text (in string): The text written in the button.

  • primary (in bool): If set to true the button is displayed with the primary accent color (default: false).

Callbacks#

  • clicked()

Example#

import { Button, VerticalBox } from "std-widgets.slint";
export component Example inherits Window {
    VerticalBox {
        Button {
            text: "Click Me";
            clicked => { self.text = "Clicked"; }
        }
    }
}