Leave Yamada UI a star

Star
Yamada UIYamada UIv1.6.4

ScaleFade

ScaleFade is a component that gradually scales up to reveal or scales down to hide an element.

Source@yamada-ui/transitions

Import

import { ScaleFade } from "@yamada-ui/react"
Copied!

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>
  </>
)
Copied!

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>
  </>
)
Copied!

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>
  </>
)
Copied!

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>
  </>
)
Copied!

Edit this page on GitHub

PreviousRotateNextSlide