--- title: FadeScale description: "`FadeScale` is a component that gradually scales up to reveal or scales down to hide an element." links: - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/fade-scale - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-fadescale--basic --- ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ## Usage ```tsx import { FadeScale } from "@yamada-ui/react" ``` ```tsx import { FadeScale } from "@/components/ui" ``` ```tsx import { FadeScale } from "@workspaces/ui" ``` ```tsx ``` ### 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`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ### Change the Duration To change the duration, set a number (in seconds) to `duration`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( その打球、消えるよ 俺はたった今からデータを捨てる!そして俺は過去を凌駕する! ) ``` ## Props | Prop | Default | Type | Description | | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `as` | - | `keyof IntrinsicElements` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `enter` | - | `any` | Custom `enter`. | | `exit` | - | `any` | Custom `exit`. A target to animate to when this component is removed from the tree. This component **must** be the first animatable child of an `AnimatePresence` to enable this exit animation. This limitation exists because React doesn't allow components to defer unmounting until after an animation is complete. Once this limitation is fixed, the `AnimatePresence` component will be unnecessary. | | `initial` | - | `any` | Custom `initial`. Properties, variant label or array of variant labels to start in. Set to `false` to initialise with the values in `animate` (disabling the mount animation) | | `delay` | `0` | `MotionLifecycleProps \| number` | Custom `delay` definition for `enter` and `exit`. | | `duration` | `0.2` | `MotionLifecycleProps \| number` | Custom `duration` definition for `enter` and `exit`. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `reverse` | `true` | `boolean` | If `true`, the element will transition back to exit state. | | `scale` | `0.95` | `number` | The initial scale of the element. | | `transition` | - | `MotionLifecycleProps` | Custom `transition` definition for `enter` and `exit`. | | `transitionEnd` | - | `MotionLifecycleProps` | Custom `transitionEnd` definition for `enter` and `exit`. | | `unmountOnExit` | - | `boolean` | If `true`, the element will unmount when `open={false}` and animation is done. |