emilk / emilk/egui

Button text alignment

Open
#7,656 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

Button has no text alignment option. For wide buttons, the text aligns left and cannot be centered without additional coding complexity. e.g.

```
let btn = ui.add(
Button::new(
RichText::new("Some text)
.color(Color32::WHITE),
)
.fill(Color32::DARK_GREEN)
.min_size(vec2(250.0, 20.0)),
);
```

Wrapping this in ```ui.horizontal``` does appear to center the text.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Button widget implementation and its existing layout or widget tests. Trace how a wide button positions its label, then add a text-alignment option that supports centering and verify that the provided wide-button example renders centered text.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.