nosignal-shell/components/controls/SwitchRow.qml
2026-04-22 22:47:18 +10:00

44 lines
987 B
QML

import QtQuick
import QtQuick.Layouts
import Caelestia.Config
import qs.components
import qs.services
StyledRect {
id: root
required property string label
required property bool checked
signal toggled(checked: bool)
Layout.fillWidth: true
implicitHeight: row.implicitHeight + Tokens.padding.extraLargeIncreased
radius: Tokens.rounding.large
color: Colours.layer(Colours.palette.m3surfaceContainer, 2)
Behavior on implicitHeight {
Anim {}
}
RowLayout {
id: row
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Tokens.padding.large
spacing: Tokens.spacing.normal
StyledText {
Layout.fillWidth: true
text: root.label
}
StyledSwitch {
checked: root.checked
enabled: root.enabled
onToggled: root.toggled(checked)
}
}
}