ScaleFade
ScaleFade
is a component that gradually scales up to reveal or scales down to hide an element.
Import
import { ScaleFade } from "@yamada-ui/react"
Usage
To control the visibility, set isOpen
.
Editable example
const { isOpen, onToggle } = useDisclosure() return ( <> <Button onClick={onToggle}>Please Click</Button> <ScaleFade isOpen={isOpen}> <Box w="full" bg="orange.500" rounded="md" p="md" color="white" mt="md"> クリリンのことか……クリリンのことかーーーっ!!!!! </Box> </ScaleFade> </> )
Change the initial scale value
To change the initial scale value, set a number to scale
. The element will scale based on this value, starting from and shrinking to it. The default is 0.95
.
Editable example
const { isOpen, onToggle } = useDisclosure() return ( <> <Button onClick={onToggle}>Please Click</Button> <ScaleFade isOpen={isOpen} scale={0.75}> <Box w="full" bg="orange.500" rounded="md" p="md" color="white" mt="md"> クリリンのことか……クリリンのことかーーーっ!!!!! </Box> </ScaleFade> </> )
Change the duration
To change the duration, set a number (in seconds) to duration
.
Editable example
const { isOpen, onToggle } = useDisclosure() return ( <> <Button onClick={onToggle}>Please Click</Button> <ScaleFade isOpen={isOpen} duration={0.4}> <Box w="full" bg="orange.500" rounded="md" p="md" color="white" mt="md"> クリリンのことか……クリリンのことかーーーっ!!!!! </Box> </ScaleFade> </> )
Unmount on exit
To unmount the component when it is not visible, set unmountOnExit
to true
.
Editable example
const { isOpen, onToggle } = useDisclosure() return ( <> <Button onClick={onToggle}>Please Click</Button> <ScaleFade isOpen={isOpen} unmountOnExit> <Box w="full" bg="orange.500" rounded="md" p="md" color="white" mt="md"> クリリンのことか……クリリンのことかーーーっ!!!!! </Box> </ScaleFade> </> )
Edit this page on GitHub