LVRS Document Viewer
components/control/CheckBox.svx
Path: components/control/CheckBox.svx
CheckBox
Location: qml/components/control/check/CheckBox.qml
CheckBox is a compact checkable control with optional text label.
Current defaults are aligned to Figma node 44:724 (State=On/Off x Available=True/False).
Purpose
- Provide deterministic check indicator rendering independent of platform style.
- Match Figma checkbox states with explicit color and border contracts.
- Support explicit palette overrides for checked/unchecked/disabled states.
API
State:
checked(inherited)enabled(inherited)text(inherited)
Visual customization:
boxSizeboxRadiuscheckColorcheckedColoruncheckedColordisabledCheckedColordisabledUncheckedColorcheckMarkColorDisabledcheckMarkStrokeWidthboxBorderWidthCheckedEnabledboxBorderWidthCheckedDisabledboxBorderWidthUncheckedEnabledboxBorderWidthUncheckedDisabledboxBorderColorCheckedEnabledboxBorderColorCheckedDisabledboxBorderColorUncheckedEnabledboxBorderColorUncheckedDisabledinnerShadowSoftColorinnerShadowStrongColor
Resolved read-only state:
showInnerShadowresolvedBoxBorderWidthresolvedBoxBorderColor
Usage
import LVRS 1.0 as LV
LV.CheckBox {
text: "Remember me"
checked: true
}
How It Works
- Component is
checkableand borderless by default. - Indicator box uses explicit state mapping:
- Checked + enabled: accent fill, no border, no inner shadow.
- Checked + disabled:
panelBackground12fill,0.5border, inner shadow. - Unchecked + enabled:
bodyColorfill,0.5border, inner shadow. - Unchecked + disabled:
panelBackground12fill, no border, inner shadow.
- Check mark is painted by
Canvasand repainted on checked/enabled/color/stroke changes. - Label uses body typography (
12 / Medium) with color mapping:- Enabled:
Theme.bodyColor - Disabled:
Theme.disabledColor
- Enabled:
- Background interaction states stay transparent so only indicator/label visuals are rendered.
Advanced Example: Custom Checkmark Weight
import LVRS 1.0 as LV
LV.CheckBox {
text: "Strict validation"
checkMarkStrokeWidth: 2
checkedColor: "#3A8DFF"
}
Troubleshooting
If checkmark appears clipped, verify control/container height and custom boxSize combination.
State Management Recommendation
For dynamic lists, bind each checkbox directly to model index properties to avoid stale closure/index bugs during reorder operations.