Rotate
Rotate
is a component that provides an animation to switch between two elements while rotating.
Import
import { Rotate } from "@yamada-ui/react"
Usage
Set the elements to switch between as from
and to
.
Editable example
return ( <Rotate from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
Change the Angle
To change the angle, set a number (degrees) to rotate
.
Editable example
return ( <Rotate rotate={360} from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
Change the Duration
To change the duration, set a number (seconds) to duration
.
Editable example
return ( <Rotate duration={0.6} from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
Add a Delay
To delay the switch, set a number (seconds) to delay
.
Editable example
return ( <Rotate delay={1} from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
Disable
To disable, set isDisabled
to true
.
Editable example
return ( <Rotate isDisabled from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
ReadOnly
To readyOnly, set isReadOnly
to true
.
Editable example
return ( <Rotate isReadOnly from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
Control
Editable example
const [value, onChange] = useState<RotateIdent>("to") return ( <Rotate value={value} onChange={onChange} from={<SunIcon fontSize="6xl" />} to={<MoonIcon fontSize="6xl" />} /> )
Edit this page on GitHub