-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add transform support #32
Comments
Hi, the translation parameter is the axis (Y or X) so there is no left/right or start/end. |
Try to imagine this switch: function Switcher(props)
{
const {
checked,
enabledLabel,
disabledLabel,
label,
onChange,
errors,
name,
description
} = props;
return(
<>
{label &&
<div className="font-medium text-gray-700 text-sm">
{label}
</div>
}
<div className="mt-1 flex rounded-md">
<div
className={`relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:shadow-outline ${checked ? 'bg-primary-600' : 'bg-gray-200'}`}
aria-checked="false"
role="checkbox"
tabIndex={0}
onClick={onChange}
>
<div
className={`inline-block h-5 w-5 rounded-full bg-white shadow transform transition ease-in-out duration-200 ${checked ? '-translate-x-5' : '-translate-x-0'}`}
aria-hidden="true"
>
</div>
</div>
<div className="ms-3 text-sm text-gray-600">
{checked
? <small>{enabledLabel}</small>
: <small>{disabledLabel}</small>
}
</div>
</div>
{errors &&
<Error errors={errors}/>
}
{description &&
<Description>{description}</Description>
}
</>
)
}
export default Switcher; The position on the X axis (left or right) varies depending on the direction. |
I understand the use case, |
@20lives Thank you! |
I know this issue is a little old. But i ran into the same issue, but on further inspection there is a |
I solve this problem by this way from documentation : |
example:
translate-s-X
translate-e-X
The text was updated successfully, but these errors were encountered: