Hero

Hero marks a shared element across two screens or states. It helps people follow an item as it moves from a list to a detail view, a message card to a thread, or a thumbnail to a focused surface.

Example

use fission::prelude::*;

fission_component! {
    pub MessageSubject<()> {
        props {
            message_id: String,
            subject: String,
        }
    }

    view(message, _state, _cx) =>
        Hero(
            tag: format!("message.subject.{}", message.message_id),
            child: Text(message.subject.clone()),
        )
}
Use the same durable message id for the matching subject in the destination screen. The subject itself is user content, so changing its wording must not change the transition identity.
To get a real transition, the corresponding destination view must wrap the matching element with the same tag.

Field table

Field
Type
Meaning
Notes / default behavior
tag
String
Stable identity for the shared element across navigation frames.
Required. Matching tags are what make the runtime treat two elements as the same thing.
child
Widget
Visual content that should participate in the transition.
Required.

Product guidance

A hero is best when it reinforces a user's mental model, not when it decorates random elements. Good candidates are thumbnails, titles, avatars, and cards that clearly represent the same object before and after navigation.
The checked-in widget does not expose timing or easing knobs. It only marks the element with a hero_tag semantic annotation. The runtime decides whether and how to animate between matching tags.

Specific advice

Tags must be stable and specific. If two unrelated elements accidentally share a tag, the transition can feel wrong or jumpy. Use domain ids rather than positional indexes when possible.

Production checklist

•
Verify matching tags refer to one logical record on both routes.
•
Test interrupted navigation and reduced motion on the actual target.
•
Do not rely on animation to communicate information missing from the destination.
Previous
FocusScope
Next
Menu