summaryrefslogtreecommitdiff
path: root/components/controls/SwitchRow.qml
diff options
context:
space:
mode:
authorATMDA <atdma2600@gmail.com>2025-11-12 15:58:42 -0500
committerATMDA <atdma2600@gmail.com>2025-11-12 15:58:42 -0500
commite92187293e4afa046ca05bd80796c1fa193097e5 (patch)
treecc9fae7544271ff03c3eb2515bc8daa0c9e1cdcd /components/controls/SwitchRow.qml
parentnotifs/toasts: reworked notifications and toasts and how they display and wor... (diff)
downloadcaelestia-shell-e92187293e4afa046ca05bd80796c1fa193097e5.tar.gz
caelestia-shell-e92187293e4afa046ca05bd80796c1fa193097e5.tar.bz2
caelestia-shell-e92187293e4afa046ca05bd80796c1fa193097e5.zip
controlcenter: refactoring into components
Diffstat (limited to 'components/controls/SwitchRow.qml')
-rw-r--r--components/controls/SwitchRow.qml47
1 files changed, 47 insertions, 0 deletions
diff --git a/components/controls/SwitchRow.qml b/components/controls/SwitchRow.qml
new file mode 100644
index 0000000..a486ee2
--- /dev/null
+++ b/components/controls/SwitchRow.qml
@@ -0,0 +1,47 @@
+import ".."
+import qs.components
+import qs.components.effects
+import qs.services
+import qs.config
+import QtQuick
+import QtQuick.Layouts
+
+StyledRect {
+ id: root
+
+ required property string label
+ required property bool checked
+ property var onToggled: function(checked) {}
+
+ Layout.fillWidth: true
+ implicitHeight: row.implicitHeight + Appearance.padding.large * 2
+ radius: Appearance.rounding.normal
+ color: Colours.tPalette.m3surfaceContainer
+
+ Behavior on implicitHeight {
+ Anim {}
+ }
+
+ RowLayout {
+ id: row
+
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: Appearance.padding.large
+ spacing: Appearance.spacing.normal
+
+ StyledText {
+ Layout.fillWidth: true
+ text: root.label
+ }
+
+ StyledSwitch {
+ checked: root.checked
+ onToggled: {
+ root.onToggled(checked);
+ }
+ }
+ }
+}
+