Skip to content

Unify number slider threshold across rows and state cards#53224

Draft
piitaya wants to merge 1 commit into
devfrom
unify-number-slider-threshold
Draft

Unify number slider threshold across rows and state cards#53224
piitaya wants to merge 1 commit into
devfrom
unify-number-slider-threshold

Conversation

@piitaya

@piitaya piitaya commented Jul 21, 2026

Copy link
Copy Markdown
Member

Proposed change

Three places decide whether a number entity in auto mode renders a slider or a text box, and one of them gets it wrong. state-card-number compares max - min against 256, the other two compare (max - min) / step.

So a number with min 0, max 1000, step 10 renders a slider in the Lovelace row and the config flow preview, and a text box in the state card, for 100 steps in every case.

Extracted showNumberSlider into src/data/number.ts and used it at all three sites, rather than spelling the formula a third time.

This changes what the state card renders for entities whose range is above 256 but whose step count is not, so it is a visible change worth a look. The row and the preview are unaffected, their behaviour is what the state card now matches.

Screenshots

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to backend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

To help with the load of incoming pull requests:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants