shadcn-vue icon indicating copy to clipboard operation
shadcn-vue copied to clipboard

[Feature]: Support RTL in shadcn components

Open lord007tn opened this issue 1 year ago • 12 comments
trafficstars

Describe the feature

It seems that components use left and right values from tailwindcss i would recommend using start and end so it supports RTL and LTR directions in projects

so instead of pr-1 , ml-2 ... we use pe-1, ms-2 And so on

also in components that have Chevron icons we should add rtl:rotate-180 class so we make sure when we change direction arrow rotate

Tasks:

  • [ ] use ( start-, end- / ps-, pe- / ms-, me- / ... ) instead of (left-, right- / pl-, pr- / ml-, mr- / ... )
  • [ ] add rotation transformation to chevrons that point to direction
  • [ ] related bug https://github.com/radix-vue/radix-vue/issues/719

Additional information

  • [X] I intend to submit a PR for this feature.
  • [ ] I have already implemented and/or tested this feature.

lord007tn avatar Feb 21 '24 15:02 lord007tn

@lord007tn Thanks for bringing it up

  1. Are you gonna add a CLI feature

  2. Or gonna change the source code classes from directional properties to logical properties?

sadeghbarati avatar Feb 22 '24 07:02 sadeghbarati

The CSS Logical Properties support table seems fine

https://caniuse.com/css-logical-props


Vite browserlist config https://github.com/vitejs/vite/blob/37af8a7be417f1fb2cf9a0d5e9ad90b76ff211b4/packages/vite/src/node/constants.ts#L19

sadeghbarati avatar Feb 22 '24 07:02 sadeghbarati

Think that logical properties is better, thanks for the PR)

hrynevychroman avatar Feb 22 '24 10:02 hrynevychroman

@sadeghbarati i will make a pr soon to change direction properties to logical properties as it seems to support i18n with multi direction website

lord007tn avatar Feb 22 '24 22:02 lord007tn

Another note, that space-x-* won't work on RTL direction. a good replacement is gap-x-* if the container already is flex/grid.

Saeid-Za avatar Feb 27 '24 08:02 Saeid-Za

any updates on this?

omar-labana avatar Mar 29 '24 14:03 omar-labana

Created a poll here please share it for others

https://github.com/radix-vue/shadcn-vue/discussions/470

sadeghbarati avatar Apr 05 '24 22:04 sadeghbarati

Coming back to this issue after a few months, could we extend the tailwind prefix functionality, to transform the component on the fly, based on user preference, before deploying them to the user machine?

Saeid-Za avatar Jun 20 '24 09:06 Saeid-Za