Skip to content

Conversation

@adrianschmidt-bot
Copy link
Contributor

@adrianschmidt-bot adrianschmidt-bot commented Jan 31, 2026

Summary

Replace the need to manually add the displays-percentage-colors class with a proper component prop. This makes the feature discoverable through TypeScript autocompletion and component documentation.

The class-based approach still works for backward compatibility since the CSS rules check for the class on the host element.

Fixes #3694

Changes

  • Added displaysPercentageColors prop to limel-slider
  • Updated getContainerClassList() to apply the class when prop is true
  • Updated the example to use the prop instead of the class

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Summary by CodeRabbit

  • New Features
    • Slider gains a new option to enable percentage-based color styling for dynamic visual feedback.
  • Documentation
    • Examples and docs updated to show using the new option instead of the legacy CSS-based approach.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Warning

Rate limit exceeded

@adrianschmidt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

Adds a public boolean prop displaysPercentageColors to the slider component and updates the example to use this prop instead of a CSS class; when true the component adds the displays-percentage-colors CSS class to the slider container.

Changes

Cohort / File(s) Summary
Slider component
src/components/slider/slider.tsx
Add public displaysPercentageColors: boolean (reflects to attribute, default false) and conditionally include the displays-percentage-colors CSS class on the slider container.
Slider example
src/components/slider/examples/slider-multiplier-percentage-colors.tsx
Replace usage of class="displays-percentage-colors" with displaysPercentageColors={true} and update example comment to reference the prop.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

feature, usability

Suggested reviewers

  • Kiarokh
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main change: adding a displaysPercentageColors prop to the slider component.
Linked Issues check ✅ Passed The PR fully implements issue #3694 requirements by adding a displaysPercentageColors prop to replace the undocumented class-based approach and improve API discoverability.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the displaysPercentageColors prop feature as specified in issue #3694; no unrelated or out-of-scope modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/slider/examples/slider-multiplier-percentage-colors.tsx (1)

30-57: 🛠️ Refactor suggestion | 🟠 Major

Wrap multiple elements in <Host> instead of an array literal.

The render method should not return an array. Wrap the elements in <Host> and add the import from @stencil/core.

♻️ Proposed refactor
-import { Component, h, State } from '@stencil/core';
+import { Component, h, Host, State } from '@stencil/core';
@@
     public render() {
-        return [
-            <limel-slider
-                displaysPercentageColors={true}
-                label="Slider with percentage colors"
-                unit=" %"
-                value={this.value}
-                factor={this.factor}
-                valuemax={this.maxValue}
-                valuemin={this.minValue}
-                disabled={this.disabled}
-                readonly={this.readonly}
-                onChange={this.changeHandler}
-            />,
-            <limel-example-controls>
-                <limel-switch
-                    value={this.disabled}
-                    label="Disabled"
-                    onChange={this.setDisabled}
-                />
-                <limel-switch
-                    value={this.readonly}
-                    label="Readonly"
-                    onChange={this.setReadonly}
-                />
-            </limel-example-controls>,
-            <limel-example-value value={this.value} />,
-        ];
+        return (
+            <Host>
+                <limel-slider
+                    displaysPercentageColors={true}
+                    label="Slider with percentage colors"
+                    unit=" %"
+                    value={this.value}
+                    factor={this.factor}
+                    valuemax={this.maxValue}
+                    valuemin={this.minValue}
+                    disabled={this.disabled}
+                    readonly={this.readonly}
+                    onChange={this.changeHandler}
+                />
+                <limel-example-controls>
+                    <limel-switch
+                        value={this.disabled}
+                        label="Disabled"
+                        onChange={this.setDisabled}
+                    />
+                    <limel-switch
+                        value={this.readonly}
+                        label="Readonly"
+                        onChange={this.setReadonly}
+                    />
+                </limel-example-controls>
+                <limel-example-value value={this.value} />
+            </Host>
+        );
     }

@adrianschmidt-bot adrianschmidt-bot requested a review from a team as a code owner January 31, 2026 17:25
@adrianschmidt adrianschmidt enabled auto-merge (rebase) January 31, 2026 18:52
@adrianschmidt adrianschmidt force-pushed the feat/slider-percentage-colors-prop branch from 760999e to 48325b3 Compare January 31, 2026 19:01
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/slider/examples/slider-multiplier-percentage-colors.tsx (1)

30-57: 🧹 Nitpick | 🔵 Trivial

Consider wrapping multiple JSX elements in <Host> instead of an array literal.

The render() method returns an array literal with multiple JSX elements. As per coding guidelines for StencilJS components, multiple top-level JSX elements should be wrapped in the special <Host> element rather than an array literal.

♻️ Proposed refactor
     public render() {
-        return [
+        return (
+            <Host>
             <limel-slider
                 displaysPercentageColors={true}
                 label="Slider with percentage colors"
                 unit=" %"
                 value={this.value}
                 factor={this.factor}
                 valuemax={this.maxValue}
                 valuemin={this.minValue}
                 disabled={this.disabled}
                 readonly={this.readonly}
                 onChange={this.changeHandler}
-            />,
+            />
             <limel-example-controls>
                 <limel-switch
                     value={this.disabled}
                     label="Disabled"
                     onChange={this.setDisabled}
                 />
                 <limel-switch
                     value={this.readonly}
                     label="Readonly"
                     onChange={this.setReadonly}
                 />
-            </limel-example-controls>,
-            <limel-example-value value={this.value} />,
-        ];
+            </limel-example-controls>
+            <limel-example-value value={this.value} />
+            </Host>
+        );
     }

Also add Host to the import:

-import { Component, h, State } from '@stencil/core';
+import { Component, h, Host, State } from '@stencil/core';

auto-merge was automatically disabled January 31, 2026 19:13

Head branch was pushed to by a user without write access

@adrianschmidt-bot adrianschmidt-bot force-pushed the feat/slider-percentage-colors-prop branch from 48325b3 to d237e29 Compare January 31, 2026 19:13
@adrianschmidt adrianschmidt force-pushed the feat/slider-percentage-colors-prop branch from d237e29 to 47f71e0 Compare January 31, 2026 19:36
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/slider/examples/slider-multiplier-percentage-colors.tsx (1)

30-57: 🛠️ Refactor suggestion | 🟠 Major

Wrap multiple top-level JSX elements in <Host> instead of an array literal.

The render method returns an array literal, but the coding guidelines require using Stencil's <Host> element for multiple top-level nodes. Add Host to the import from @stencil/core and wrap the elements accordingly.

♻️ Proposed refactor
-import { Component, h, State } from '@stencil/core';
+import { Component, h, Host, State } from '@stencil/core';

 public render() {
-    return [
-        <limel-slider
-            displaysPercentageColors={true}
-            label="Slider with percentage colors"
-            unit=" %"
-            value={this.value}
-            factor={this.factor}
-            valuemax={this.maxValue}
-            valuemin={this.minValue}
-            disabled={this.disabled}
-            readonly={this.readonly}
-            onChange={this.changeHandler}
-        />,
-        <limel-example-controls>
-            <limel-switch
-                value={this.disabled}
-                label="Disabled"
-                onChange={this.setDisabled}
-            />
-            <limel-switch
-                value={this.readonly}
-                label="Readonly"
-                onChange={this.setReadonly}
-            />
-        </limel-example-controls>,
-        <limel-example-value value={this.value} />,
-    ];
+    return (
+        <Host>
+            <limel-slider
+                displaysPercentageColors={true}
+                label="Slider with percentage colors"
+                unit=" %"
+                value={this.value}
+                factor={this.factor}
+                valuemax={this.maxValue}
+                valuemin={this.minValue}
+                disabled={this.disabled}
+                readonly={this.readonly}
+                onChange={this.changeHandler}
+            />
+            <limel-example-controls>
+                <limel-switch
+                    value={this.disabled}
+                    label="Disabled"
+                    onChange={this.setDisabled}
+                />
+                <limel-switch
+                    value={this.readonly}
+                    label="Readonly"
+                    onChange={this.setReadonly}
+                />
+            </limel-example-controls>
+            <limel-example-value value={this.value} />
+        </Host>
+    );
 }

@adrianschmidt-bot adrianschmidt-bot force-pushed the feat/slider-percentage-colors-prop branch from 47f71e0 to 64d950a Compare January 31, 2026 22:30
Replace the need to manually add the `displays-percentage-colors` class
with a proper component prop. This makes the feature discoverable through
TypeScript autocompletion and component documentation.

The class-based approach still works for backward compatibility since the
CSS rules check for the class on the host element.

Fixes Lundalogik#3694
@adrianschmidt adrianschmidt force-pushed the feat/slider-percentage-colors-prop branch from 64d950a to 862ccf4 Compare January 31, 2026 23:06
@github-actions
Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3804/

Copy link
Contributor

@adrianschmidt adrianschmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@adrianschmidt adrianschmidt merged commit d288063 into Lundalogik:main Jan 31, 2026
9 of 10 checks passed
@lime-opensource
Copy link
Collaborator

🎉 This PR is included in version 38.44.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slider: make a prop instead of class="displays-percentage-colors"

3 participants