mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-25 09:28:04 +00:00
33 lines
1 KiB
Text
33 lines
1 KiB
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { BaseButton } from "./base_button.slint";
|
|
import { Typography } from "../styling/typography.slint";
|
|
import { MaterialPalette } from "../styling/material_palette.slint";
|
|
|
|
export component TextButton {
|
|
in property <image> icon <=> base.icon;
|
|
in property <string> text <=> base.text;
|
|
in property <bool> enabled <=> base.enabled;
|
|
in property <string> tooltip <=> base.tooltip;
|
|
in property <bool> inverse;
|
|
|
|
callback clicked <=> base.clicked;
|
|
|
|
accessible-role: button;
|
|
accessible-enabled: root.enabled;
|
|
accessible-label: root.text == "" ? root.tooltip : root.text;
|
|
accessible-action-default => { base.clicked(); }
|
|
|
|
base := BaseButton {
|
|
border_radius: root.height / 2;
|
|
color: root.inverse ? MaterialPalette.inverse_primary : MaterialPalette.primary;
|
|
}
|
|
|
|
states [
|
|
disabled when !root.enabled : {
|
|
base.color: MaterialPalette.on_surface;
|
|
base.transparent_background: true;
|
|
}
|
|
]
|
|
}
|