import QtQuick import "." Surface { id: button // "primary" | "secondary" | "accent" | "destructive" | "success" | "warning" | "info" property string variant: "primary" property string text: "" signal clicked() // primary and accent are the same color (Theme.colors.primary === .accent); // kept as separate variant names for call-site clarity. readonly property bool filled: variant === "primary" || variant === "accent" readonly property color variantColor: variant === "accent" ? Theme.colors.accent : variant === "destructive" ? Theme.colors.alert : variant === "success" ? Theme.colors.success : variant === "warning" ? Theme.colors.warning : variant === "info" ? Theme.colors.info : Theme.colors.primary implicitWidth: label.implicitWidth + Theme.geometry.padding * 2 implicitHeight: label.implicitHeight + Theme.geometry.padding width: implicitWidth height: implicitHeight color: filled ? (mouseArea.containsMouse ? Qt.lighter(variantColor, 1.15) : variantColor) : (mouseArea.containsMouse ? Theme.colors.surfaceHover : Theme.colors.surface) tint: variantColor glow: !filled && mouseArea.containsMouse pressed: mouseArea.pressed Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } } Text { id: label anchors.centerIn: parent text: button.text font.family: Theme.font.headlineFamily font.pixelSize: 14 font.bold: true font.capitalization: Font.AllUppercase color: button.filled ? Theme.colors.textOnAccent : button.variantColor } MouseArea { id: mouseArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: button.clicked() } }