-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is your feature request related to a problem? Please describe.
Following on from my StackOverflow question...
In my Blazor components I often render components based on either a conditional statement, e.g.
@if (_contact.IsCustomer)
{
<SalesOrdersList Customer="@_contact" />
}
Or from a loop, e.g.
@foreach(var salesOrder in _customer.SalesOrders)
{
<SalesOrderSummary SalesOrder="@salesOrder" />
}
When I change the state I'd like to animate the state transition so that the components fade in/out. In the examples above that might happen when IsCustomer changes, or when a record is added or removed from the SalesOrders collection.
Animating adding a component can be done with CSS, but I think that animating the removal of a component will be impossible because it simply doesn't exist in the next render, so there's nothing to hang the animation onto?
Describe the solution you'd like
In React there used to be a series of attributes related to state transitions, which now seem to have been replaced by react-transition-group. That looks like a big hammer for what seems like a fairly small nut.
Ideally I'd favour something really simple to use, like having an on-removal-class attribute for the name of a CSS class that's then added to the component, and allowed to complete, when the item is identified for removal from the render tree. That seems like it may be possible, because if I understand Blazor correctly the new and old render trees are diff'd to work out what parts to re-render?
There are potentially lots of other things you might want to happen in a state transition too, and no-doubt some that can't be handled with CSS alone, but I think the animation side of things is fairly important to aid users in understanding the consequences of a particular UI interaction?