ButtonContentAlign
ButtonContentAlign controls where Button
places its child. Leave content centered for ordinary actions. Align it to the start or end when
a wide toolbar, row, or menu button should read like a list item.
Example
use fission::prelude::*;
fission_component! {
pub OpenProject<AppState>
view(_button, _state, cx) =>
Button(
width: 280.0,
content_align: ButtonContentAlign::Start,
child: Text(cx.tr("project.open")),
key: "open-project",
on_press: reduce { cx.effects.navigate("/projects"); },
)
}
In this example the button is intentionally wider than its label, so Start makes the text read like a list row instead of a centered badge.
Choice table
| | | |
|---|
| | Centers the child inside the button content box. | Default. Best for standard action buttons. |
| | Places the child at the leading edge of the button content box. | Useful for full-width buttons, menu-like rows, and text-plus-icon actions that should read from left to right. |
| | Places the child at the trailing edge of the button content box. | Useful for trailing utility actions, but uncommon for primary actions. |
When to use it
Use this setting when the content alignment inside the button is part of the interaction design. A full-width settings row with a label and icon often wants Start. A compact toolbar button might still want Center.
Do not use ButtonContentAlign to solve outer layout problems. If the whole button needs to move left, right, or fill available width, change the parent layout with Row, Align, or a width setting on the button itself. Specific advice
If your button child is already a layout widget such as an HStack with its own spacer, keep the two layers of alignment straight. ButtonContentAlign controls where that whole child sits inside the button. The child widget still controls spacing inside itself.