Skip to content

Commit

Permalink
Add RTL support to the switch component (#2468)
Browse files Browse the repository at this point in the history
* fix: add RTL support to the switch component

* fix: convert changeset rtl switch to ptach
  • Loading branch information
mrbadri authored Mar 8, 2024
1 parent 0443ec1 commit a702bb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-keys-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nextui-org/switch": patch
---

Add RTL support to the switch component
10 changes: 5 additions & 5 deletions packages/core/theme/src/components/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ const toggle = tv({
"rounded-full",
"origin-right",
],
startContent: "z-0 absolute left-1.5 text-current",
endContent: "z-0 absolute right-1.5 text-default-600",
startContent: "z-0 absolute left-1.5 rtl:right-1.5 rtl:left-[unset] text-current",
endContent: "z-0 absolute right-1.5 rtl:left-1.5 rtl:right-[unset] text-default-600",
thumbIcon: "text-black",
label: "relative text-foreground select-none",
},
Expand Down Expand Up @@ -100,7 +100,7 @@ const toggle = tv({
},
size: {
sm: {
wrapper: "w-10 h-6 mr-2",
wrapper: "w-10 h-6 mr-2 rtl:ml-2 rtl:mr-[unset]",
thumb: [
"w-4 h-4 text-tiny",
//selected
Expand All @@ -111,7 +111,7 @@ const toggle = tv({
label: "text-small",
},
md: {
wrapper: "w-12 h-7 mr-2",
wrapper: "w-12 h-7 mr-2 rtl:ml-2 rtl:mr-[unset]",
thumb: [
"w-5 h-5 text-small",
//selected
Expand All @@ -122,7 +122,7 @@ const toggle = tv({
label: "text-medium",
},
lg: {
wrapper: "w-14 h-8 mr-2",
wrapper: "w-14 h-8 mr-2 rtl:ml-2 rtl:mr-[unset]",
thumb: [
"w-6 h-6 text-medium",
//selected
Expand Down

0 comments on commit a702bb8

Please sign in to comment.