Slot Transition Group

SlotTransitionGroup React primitive for time-based transitions without an extra wrapper element, with slot-based mount, active, and exit states

import { SlotTransitionGroup } from "@plexui/ui/components/Transition";

<SlotTransitionGroup> behaves like <TransitionGroup> but applies transition data attributes directly to the child elements instead of adding a wrapper. Prefer <Animate>, <AnimateLayout>, or <AnimateLayoutGroup> first. Use when you need transition state without an extra wrapper node. Children must have a stable key.

Examples

Overview

Timing is controlled by enterDuration and exitDuration. No default styles are applied; use the data attributes below in your CSS.

Transition states

Attributes are applied on the child; no default styles.

AttributeDescription
data-enteringEnter transition staged; applied for full entrance.
data-entering-activeEnter transition active.
data-exitingExit transition staged; applied for full exit.
data-exiting-activeExit transition active.
data-interruptedSwitched to the opposite transition before completion.

Initial mount

By default, children do not transition on the group's initial mount. Use preventInitialTransition= to allow it.

CSS example

Apply styles to the child using the data attributes:

.Example {
  &[data-entering] { opacity: 0; }
  &[data-exiting] { opacity: 1; }
  &[data-entering-active],
  &[data-exiting][data-interrupted] {
    opacity: 1;
    box-shadow: 0 0 0 5px green;
    transition: opacity 2s ease, box-shadow 2s ease;
  }
  &[data-exiting-active],
  &[data-entering][data-interrupted] {
    opacity: 0;
    box-shadow: 0 0 0 5px red;
    transition: opacity 1s ease, box-shadow 1s ease;
  }
}

Vue

import { SlotTransitionGroup } from "@plexui/vue/components/Transition";

Props and data attributes are the same as in React. The data attributes land on the slot child itself.

Reference

PropTypeDefaultDescription
enterDurationnumber—Duration in ms for enter transition
exitDurationnumber—Duration in ms for exit transition
preventInitialTransitionbooleantrueWhen false, children transition on the group's initial mount