LayoutGroup
like LayoutGroup in framer-motion, the LayoutGroup will detect the layout changes of its children and apply the layout animations.
like LayoutGroup
in framer-motion, the LayoutGroup
will detect the layout changes of its children and apply the layout animations.
1. without LayoutGroup
2. with LayoutGroup
Props
id
A unique identifier for the layout group. If not provided, the group will be identified by its context.
inherit
Controls how the layout group inherits properties from its parent group. It can be:
true
: Inherit both id andgroup
.id
: Only inherit the id.group
: Only inherit thegroup
.
Slots
default
: The default slot receives forceRender function:
- forceRender: A function that, when called, forces the slot Motion component to calculate its layout.
When a Motion
component is wrapped by LayoutGroup
, its update will trigger layout updates for all Motion
components under the LayoutGroup
, so it's better to trigger the Motion
update instead of calling forceRender
useLayoutGroup
The useLayoutGroup
hook provides access to the layout group context, allowing components to participate in the layoutGroup and respond to forced layout.