This document explains the internal reusable building blocks in components/.
Use these components before creating a new bar chip, hover popup shell, or popup row primitive.
These are internal repo conventions, not public API guarantees.
Use style-guide.md alongside this file for shell-wide naming, visual language, and popup content rules.
The components/ layer exists to:
- keep bar widgets on one composition pattern
- keep hover popups on one layout and animation pattern
- avoid repeating chip and popup wiring in each widget
- give AI and contributors a clear first stop before introducing new wrappers
Import the module with:
import "../../components" as ComponentsAdjust the relative path for the file you are editing.
For new bar work:
- start with
Components.WidgetChip - use
popupContentfor hover popup content - use
Components.HoverPopupFrameinside the popup component - use
Components.HoverPopupPresetsunless the popup needs a deliberate override
Drop to Components.ModuleChip only when WidgetChip is too opinionated for the widget you need.
Low-level bar chip base with:
- optional leading segment
- optional value segment
- hover and click state
- hover popup metadata consumed by
modules/bar/BarHoverPopupHost.qml
Use it when:
- the widget still fits the shell's two-segment chip model
WidgetChipis close, but you need direct control over chip colors or value content structure
Important properties:
leadingTextclickablehoverableactivehoverPopuphoverPopupWidthhoverPopupOffsetYhoverPopupCollapsedWidthhoverPopupOpenAnimationStylehoverPopupCloseAnimationStylehoverPopupKey
Signal:
clicked(button)
Minimal pattern:
Components.ModuleChip {
leadingText: "CPU"
clickable: true
hoverable: true
hoverPopup: cpuPopup
Text {
text: "34%"
}
onClicked: button => {
if (button === Qt.LeftButton)
doSomething()
}
}Preferred entry point for new bar widgets.
WidgetChip wraps ModuleChip and applies:
- shell widget style presets
- icon segment defaults
- popup preset defaults
- standard
valueTextrendering - optional
valueContentloader for custom value layout
Use it when:
- building a normal bar widget
- the widget has a single primary signal and optional hover popup
- the shell's existing bar language should apply unchanged
Important properties:
appearancePresettonepopupPreseticonGlyphpopupContentvalueTextvalueContentinteractivepopupKeypopupWidthpreferredValueWidthmaximumValueWidth
Minimal pattern:
Components.WidgetChip {
iconGlyph: ""
valueText: Services.NetworkState.accessPointLabel
popupPreset: Components.HoverPopupPresets.wifi
popupContent: wifiPopup
}Prefer valueText unless the widget really needs custom content. Use valueContent only when a plain text value is not enough.
Default base for widget hover popups.
Use it for:
- widget popups in
modules/bar/popups/ - small hover information popups
- popup cards that should match the shell's current bar popup language
Important properties:
minPopupWidthcontentSpacing- default
contentData
Minimal pattern:
Components.HoverPopupFrame {
minPopupWidth: 275
Rectangle {
Layout.fillWidth: true
implicitHeight: 48
color: Theme.Theme.surface0
}
}This component gives you the outer popup shell.
Shared inner card shell for bar hover popups.
Use it for:
- the square inner cards inside
modules/bar/popups/ - popup sections that need the standard surface, border, and inner padding
Important properties:
- default
contentData contentSpacingcontentMarginextraHeightwhen a popup needs a small height adjustment without reintroducing a custom shell
Shared popup behavior defaults for widget popups.
Available preset names today:
defaultPresetaudiobatterycalendarfor the current clock popup preset namecpuramwifi
The clock popup component is named ClockHover.qml, but its current preset name is still calendar. Treat ClockHover as the user-facing concept name in new prose and filenames unless the code path is intentionally renamed.
Use it when:
- a widget popup should follow standard open and close animation choices
- a widget needs a popup key that other code can react to
The most important caller is WidgetChip, which reads the preset and forwards:
offsetYcollapsedWidthdurationopenDurationcloseDurationopenAnimationcloseAnimationkey
Typical usage:
Components.WidgetChip {
popupPreset: Components.HoverPopupPresets.cpu
}Use a custom override only when the popup genuinely needs behavior outside the current preset set.
Preferred label/value row for popup cards.
Use this for bar hover popups in modules/bar/popups/.
If the surface is a pane, menu, settings card, or other general shell popup outside the bar hover-popup path, use Ui.ShellKeyValueRow from shared-ui.md instead.
Use it for:
- short metric summaries
- battery, network, and system information rows
- compact popup metadata
Important properties:
labelvaluelabelColumnWidthlabelElide(defaults toText.ElideNone; useText.ElideMiddlefor bounded discovered names)centerValueWhenLabelEmptyvalueWrap
Preferred row for top-process style popup lists.
Use this for bar hover popups, not for general pane or menu lists.
Use it when showing:
- PID
- process/command text
- a trailing metric such as CPU percent or RSS
Important properties:
pidcommandmetricText
Preferred metric bar for bar hover popups.
Use it for:
- popup metric fills in
modules/bar/popups/ - popup bars that need optional overlay content such as a trailing percent label
Important properties:
valuefrom0to1fillColortrackColorfillOpacitybarHeight- default
overlayData
Preferred thin divider for popup sections.
Use it instead of ad hoc Rectangle { implicitHeight: 1 } separators in hover popups.
Use this for notification app icons instead of rebuilding icon fallback logic.
It already integrates with Services.TrayIconResolver.notificationIconCandidates(...) and the shell's fallback treatment.
Ready-made clock widget built on WidgetChip.
Treat this as a real reference implementation for a simple widget with popup content.
Use components/ when:
- building bar widgets
- building hover popups tied to bar widgets
- wiring popup animation behavior through widget-level presets
Use ui/ when:
- building panes
- building menus and settings surfaces
- building general shell controls such as buttons, sections, text fields, and section frames
See shared-ui.md for the ui/ layer.
- prefer
WidgetChipoverModuleChip - prefer
HoverPopupFrameover a new popup shell wrapper - prefer popup helper rows over local one-off clones in bar hover popups
- if the popup belongs to a pane, menu, or settings surface instead of the bar, prefer the
ui/equivalents fromshared-ui.md - extend presets only when at least 2 real widgets want the same popup behavior
- if a widget cannot fit the chip model, stop and confirm that it really belongs in the bar before creating a new primitive
components/DigitalClock.qmlmodules/bar/widgets/CpuWidget.qmlmodules/bar/widgets/RamWidget.qmlmodules/bar/widgets/AudioWidget.qmlmodules/bar/widgets/BatteryWidget.qmlmodules/bar/widgets/TemperatureWidget.qmlmodules/bar/widgets/WifiWidget.qmlmodules/bar/popups/CpuHover.qmlmodules/bar/popups/RamHover.qmlmodules/bar/popups/WifiHover.qmlmodules/bar/popups/BatteryHover.qml