I want to make an animated tab like:

I am using React with Tailwind. This is my code:
import React from 'react'
import clsx from 'clsx'
export const Modal = () => {
const [theme, setTheme] = React.useState<'light' | 'dark' | 'system'>('light')
return (
<div className="flex mx-2 mt-2 rounded-md bg-blue-gray-100">
<div
className={clsx('flex-1 py-1 my-2 ml-2 text-center rounded-md', {
'bg-white': theme === 'light',
'transition duration-1000 ease-out transform translate-x-10':
theme !== 'light',
})}
>
<button
className={clsx(
'w-full text-sm cursor-pointer select-none focus:outline-none',
{
'font-bold text-blue-gray-900': theme === 'light',
'text-blue-gray-600': theme !== 'light',
}
)}
onClick={() => {
setTheme('light')
}}
>
Light
</button>
</div>
<div
className={clsx('flex-1 py-1 my-2 ml-2 text-center rounded-md', {
'bg-white': theme === 'dark',
})}
>
<button
className={clsx(
'w-full text-sm cursor-pointer select-none focus:outline-none',
{
'font-bold text-blue-gray-900': theme === 'dark',
'text-blue-gray-600': theme !== 'dark',
}
)}
onClick={() => {
setTheme('dark')
}}
>
Dark
</button>
</div>
<div
className={clsx('flex-1 py-1 my-2 mr-2 text-center rounded-md', {
'bg-white': theme === 'system',
})}
>
<button
className={clsx(
'w-full text-sm cursor-pointer select-none focus:outline-none',
{
'font-bold text-blue-gray-900': theme === 'system',
'text-blue-gray-600': theme !== 'system',
}
)}
onClick={() => {
setTheme('system')
}}
>
System
</button>
</div>
</div>
)
}
But it looks like:

As I use translate-x-10 when the theme is not light, therefore the text moves as well.
I would love to make the UI exactly as the above one while still using buttons for the actual tabs.
Minimal Codesandbox → https://codesandbox.io/s/mobx-theme-change-n1nvg?file=/src/App.tsx
How do I do it?