Hi I feel a lag while using shadcn ui with next-themes to change the theme of the theme button. I'm using the same code as mentioned at: https://github.com/shadcn-ui/ui/blob/main/apps/www/components/mode-toggle.tsx#L21
Heres my git repo: https://github.com/alvinsjoy/PortfolioWebsite/blob/main/components/ThemeSwitcher.tsx#L23
The first video is from my website (https://www.alvinjoy.live) and the second is from https://ui.shadcn.com
Does anyone know why is it happening? Is something wrong with my configs?
#Lag during theme change (shadcn ui, next.js)
14 messages · Page 1 of 1 (latest)
<Button variant="ghost" className="w-9 px-0">
<Button
!helper
Hello
hi
how can i help you?
can you tell me whats causing the lag here?
please check the videos for better understanding
@stray sedge
Your css has
.transition-all {
transition-property: all;
transition-timing-function: cubic-bezier(.4,0,.2,1);
transition-duration: .15s;
}
is that related?
even if the transition is none there is a lag in color change of the icon
i found that this is actually intentional and can be disabled in the next themes provider (https://github.com/pacocoursey/next-themes?tab=readme-ov-file#disable-transitions-on-theme-change)
thanks