Flip
Flip
is a component that provides an animation to switch between two elements while flipping.
Import
import { Flip } from "@yamada-ui/react"
Usage
Set the elements to switch between as from
and to
.
Editable example
return <Flip from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} />
Change Direction
To change the direction, set orientation
to either "vertical"
or "horizontal"
. The default is "horizontal"
.
Editable example
return ( <Flip orientation="vertical" from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
Change Duration
To change the duration, set duration
to a number (seconds).
Editable example
return ( <Flip duration={1.4} from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
Add Delay
To delay the switch, set delay
to a number (seconds).
Editable example
return ( <Flip delay={1} from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
Disable
To disable, set isDisabled
to true
.
Editable example
return ( <Flip isDisabled from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
ReadOnly
To readyOnly, set isReadOnly
to true
.
Editable example
return ( <Flip isReadOnly from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
Control
Editable example
const [value, onChange] = useState<FlipIdent>("from") return ( <Flip value={value} onChange={onChange} from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
Customize
Editable example
return ( <Flip transition={{ type: "spring", damping: 10, stiffness: 120, }} from={<Apple fontSize="6xl" />} to={<Cherry fontSize="6xl" />} /> )
Edit this page on GitHub