Files
NODEDC_DESIGN_GUIDELINE/docs/LEVEL_BUTTON.md

1.9 KiB
Raw Permalink Blame History

LevelButton

Measured resource level inside the standard pill Button. Initial consumer: Mission Core battery state in the observatory header. Width is 2.5 canonical controls; height, focus, keyboard, disabled and hover grammar remain Button-owned.

value is a fraction in [0,1]; unknown/NaN has no fill and displays an em dash. valueText supplies the visible value; label names the resource. freshness is live, stale or unknown. Stale retains the reading, neutralises fill and adds accessible last-reading text. No animation, no fabricated progress, no nested interactive elements. levelTone uses semantic tokens, never a local palette.

Click opens domain details supplied by the consumer. The consumer decides which physical resource is selected; it must not average unrelated batteries or treat a stale number as fresh. Catalog includes normal, stale and unavailable states.

An explicit operator-selected fillColor (#RRGGBB) overrides semantic tint. The measured fraction clips a solid fill and a second, aria-hidden copy of its label. WCAG luminance chooses black/white text independently over the filled part, while the unfilled part keeps the normal theme text. Unknown has no fill; stale retains the chosen colour and its accessible stale label. Colour-range configuration belongs to the domain profile, not the visual component.

geometry={{width, height, radius}} задаёт операторские размеры с минимумом 32 × 12 px. Ниже 64 × 24 текст и padding уменьшаются пропорционально ограничивающему размеру; длинная подпись также учитывается. Оба слоя текста наследуют одинаковые размеры. Без geometry сохраняется прежний размер Button. Внешний отступ от соседних действий остаётся ответственностью композиции шапки.