PartsRS/material-1.0/ui/components/text_button.slint
2025-11-07 14:04:55 +01:00

33 lines
1.1 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
import { BaseButton } from "./base_button.slint";
import { MaterialTypography } from "../styling/material_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;
}
]
}