use fission::prelude::*;
fission_component! {
pub DocumentActions<()> {
props {
save: ActionEnvelope,
preview: ActionEnvelope,
delete: ActionEnvelope,
}
}
view(actions, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
} =>
Wrap(
spacing: tokens.spacing.s,
run_spacing: tokens.spacing.s,
children: [
Button(
variant: ButtonVariant::Primary,
child: Text(cx.tr("document.save")),
on_press: actions.save.clone(),
),
Button(
variant: ButtonVariant::SecondaryGray,
child: Text(cx.tr("document.preview")),
on_press: actions.preview.clone(),
),
Button(
variant: ButtonVariant::Destructive,
child: Text(cx.tr("document.delete")),
on_press: actions.delete.clone(),
),
],
)
}
Choice | Type | Meaning | Notes / default behavior |
|---|---|---|---|
Filled / Primary | ButtonVariant | Primary action hierarchy. | Filled is the default compatibility name; both resolve the design system's primary recipe. |
Outline / SecondaryGray | ButtonVariant | Neutral secondary hierarchy. | Use for an alternative that should remain clearly actionable without competing with the primary action. |
Ghost / TertiaryGray | ButtonVariant | Neutral tertiary hierarchy. | Use for toolbars and low-emphasis utility actions. |
SecondaryColor | ButtonVariant | Brand-colored secondary hierarchy. | Keeps brand emphasis while remaining subordinate to Primary. |
TertiaryColor | ButtonVariant | Brand-colored tertiary hierarchy. | Appropriate for a quiet action that still benefits from brand color. |
LinkColor | ButtonVariant | Brand-colored link hierarchy. | Use only when an action should visually read as a link-like control. |
LinkGray | ButtonVariant | Neutral link hierarchy. | Quietest link-like action treatment. |
Destructive | ButtonVariant | Destructive action hierarchy. | Reserve for actions with harmful or difficult-to-reverse consequences. |