Skip to content

fix(panel): make the icon field match the panel's own inputs - #862

Merged
tempus2016 merged 2 commits into
mainfrom
fix/icon-picker-field-style
Sep 11, 2026
Merged

fix(panel): make the icon field match the panel's own inputs#862
tempus2016 merged 2 commits into
mainfrom
fix/icon-picker-field-style

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

ha-icon-picker is Home Assistant's own component, so in the panel's dialogs it rendered with a Material shell — grey fill, dark active-indicator line, square bottom corners and a 56px box — sitting beside 37px tm-inputs styled by the panel. It read as a borrowed control rather than part of the form.

It is kept (the searchable MDI list is worth it) but wrapped in a .tm-icon-well that carries the tm-input frame, with the picker itself stripped back to transparent.

Before / after

Before grey filled box, underline, 56px tall next to a 37px Cost field
After same height, border, radius and background as the field beside it

How

  • The fill and the indicator line are var() usages inside ha-picker-field, so overriding --ha-color-form-background and --ha-color-border-neutral-loud from the light DOM does reach them.
  • The 56px row height and the square bottom corners are hard-set on ha-combo-box-item inside the shadow root, and no variable overrides them. So the well is a fixed tm-input-height box with overflow:hidden, and the picker is pulled up by half the difference to keep its contents optically centred. That offset is the fragile bit — if HA changes the 56px row height the icon drifts — and it is commented in the CSS.
  • The --mdc-text-field-* overrides are kept alongside for older HA, which still renders an mwc textfield here.

Scope

This changes the shared _iconPickerField helper, so every dialog using it is covered: reward, chore, badge, quest, challenge and child avatar. The settings page's points_icon picker and the notification period rows build their own markup and are left alone.

Testing

Verified on the live ha-dev instance, not just locally:

  • Reward and chore dialogs render the field matching its neighbours (well 37px, same frame).
  • The picker still works: click opens the list anchored under the field, typing star filters it, clears.
  • An empty picker (no icon set) renders as an empty well with just the chevron — nothing is clipped by the fixed height.
  • ESLint clean, 1792 tests pass.

Not verified: dark theme has no screenshot — the browser profile's own theme setting overrides frontend.set_theme on ha-dev. The well is built from the same tokens as .tm-input (--tm-surface-0, --tm-border, --tm-accent), so it tracks the theme the way the other inputs do by construction.

ha-icon-picker is HA's component, so it rendered with a Material shell —
grey fill, dark underline, square bottom corners and a 56px box — next to
31/37px tm-inputs styled by the panel. Wrap it in a .tm-icon-well that
carries the tm-input frame and strip the picker back to transparent.

The fill and indicator line are var() usages inside ha-picker-field, so
overriding them from the light DOM reaches them. The 56px row height and
the square bottom corners are hard-set on ha-combo-box-item inside the
shadow root and no variable overrides them, hence the fixed-height well
with overflow:hidden and the half-difference offset.

Search, the dropdown and clearing are untouched.
@github-actions github-actions Bot added the cards Lovelace cards / frontend (www/*.js) label Sep 11, 2026
@tempus2016
tempus2016 merged commit 67b1e5a into main Sep 11, 2026
16 checks passed
@tempus2016
tempus2016 deleted the fix/icon-picker-field-style branch September 11, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cards Lovelace cards / frontend (www/*.js)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant