Skip to content

Commit

Permalink
Update Switch component
Browse files Browse the repository at this point in the history
- Add support for RTL layouts
- Add <slot name="thumb" /> to allow inject icons inside  the thumb
  • Loading branch information
mhelaiwa authored Oct 16, 2024
1 parent e63d555 commit 56ea270
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/www/src/lib/registry/default/ui/switch/Switch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits)
)"
>
<SwitchThumb
:class="cn('pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0')"
/>
:class="cn('pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform ltr:data-[state=checked]:translate-x-5 rtl:data-[state=checked]:-translate-x-5')"
>
<slot name="thumb" />
</SwitchThumb>
</SwitchRoot>
</template>

0 comments on commit 56ea270

Please sign in to comment.