--- title: SlideFade description: "`SlideFade` is a component that gradually shows or hides an element while moving it from a specified position." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slide-fade/slide-fade.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slide-fade - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-slidefade--basic --- ```tsx const [open, { toggle }] = useBoolean() return ( クラスは最低じゃないぞ!メンバーが最低なだけだ! ) ``` ## Usage ```tsx import { SlideFade } from "@yamada-ui/react" ``` ```tsx import { SlideFade } from "@/components/ui" ``` ```tsx import { SlideFade } from "@workspaces/ui" ``` ```tsx ``` ### Change the Duration To change the duration, set a number (in seconds) to `duration`. ```tsx const [open, { toggle }] = useBoolean() return ( 確かにアイツは勉強ができない。でもな、学力が低いからといって、全てが決まるわけじゃないだろう? ) ``` ### Change the Position To change the position, specify a string or number for `offsetX` or `offsetY`. ```tsx const [open, { toggle }] = useBoolean() return ( ……私、このクラスの皆が好きなんです。人の為に一生懸命な皆のいる、Fクラスが ……女は胸じゃないのに。アキの、バカ…… ) ``` ### Unmount on Exit To unmount the component when it is not visible, set `unmountOnExit` to `true`. ```tsx const [open, { toggle }] = useBoolean() return ( 考えすぎではないかのぅ。メイド服くらい人間一度は着るものじゃ ) ``` ### Delay To delay the animation, set a number (in seconds) to `delay`. ```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`. | | `offsetX` | `0` | `number \| string` | The offset on the horizontal or `x` axis. | | `offsetY` | `8` | `number \| string` | The offset on the vertical or `y` axis. | | `open` | - | `boolean` | Show the component. triggers when enter or exit states. | | `reverse` | `true` | `boolean` | If `true`, the element will be transitioned back to the offset when it leaves. Otherwise, it'll only fade out. | | `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. |