Files
metabuilder/qml/components/form/CFormLabel.qml
johndoe6345789 de3a3ac194 feat(qml): MD3 rework batch 2 — 17 more components rewritten
Feedback: CAlert (tonal + accent bar), CDialog (radius 28, scale anim), CSnackbar (inverse surface, slide-in)
Navigation: CTabBar (animated indicator pill), CListItem (state layers), CBreadcrumbs (full rewrite)
Data: CAvatar (tonal primary), CDivider (theme-aware), CTable (hover rows, sort arrows, proper padding)
Typography: CText (full MD3 type scale inline), CTitle (extends CText), CCodeBlock (radius 12), CCodeInline (radius 4)
Forms: CFormGroup (focus/error states), CFormLabel (animated color), CLabel (control association), CAutocomplete (styled popup)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 04:03:58 +00:00

48 lines
1.1 KiB
QML

import QtQuick
import QtQuick.Controls
import QmlComponents 1.0
/**
* CFormLabel.qml - Material Design 3 form label
* 12px medium-weight label with focus, error, and required states
*/
Text {
id: label
property alias text: label.text
property bool required: false
property bool focused: false
property bool error: false
property bool disabled: false
text: "Label"
color: {
if (disabled) return Theme.textDisabled
if (error) return Theme.error
if (focused) return Theme.primary
return Theme.textSecondary
}
font.pixelSize: 12
font.weight: Font.Medium
font.family: Theme.fontFamily
opacity: disabled ? 0.38 : 1
// Append required asterisk via overlay to keep text property clean
Text {
anchors.left: parent.right
anchors.baseline: parent.baseline
text: " *"
color: Theme.error
font.pixelSize: 12
font.weight: Font.Medium
font.family: Theme.fontFamily
visible: label.required
}
Behavior on color {
ColorAnimation { duration: Theme.transitionShortest }
}
}