Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(progress): add RTL support to the progress component (#4908) #4911

Open
wants to merge 2 commits into
base: canary
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/happy-kangaroos-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@heroui/progress": patch
---

These changes ensure that the progress bar behaves correctly in both LTR and RTL layouts, which is crucial for supporting languages that read from right to left (like Arabic, Hebrew, etc.). The transform origin points are particularly important for animations and transitions of the progress indicator.

In the track class:
Added rtl:rotate-180 which rotates the track 180 degrees when in RTL mode, ensuring correct direction

In the indicator class added RTL-aware origin points:
rtl:origin-right sets the transform origin to the right side in RTL mode.
ltr:origin-left sets the transform origin to the left side in LTR (Left-to-Right) mode.
12 changes: 9 additions & 3 deletions packages/core/theme/src/components/progress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const progress = tv(
label: "",
labelWrapper: "flex justify-between",
value: "",
track: "z-0 relative bg-default-300/50 overflow-hidden",
indicator: "h-full",
track: "z-0 relative bg-default-300/50 overflow-hidden rtl:rotate-180",
indicator: "h-full rtl:origin-right ltr:origin-left",
},
variants: {
color: {
Expand Down Expand Up @@ -97,7 +97,13 @@ const progress = tv(
},
isIndeterminate: {
true: {
indicator: ["absolute", "w-full", "origin-left", "animate-indeterminate-bar"],
indicator: [
"absolute",
"w-full",
"rtl:origin-right",
"ltr:origin-left",
"animate-indeterminate-bar",
],
},
},
isDisabled: {
Expand Down