# Makie - how to align text in a Button

**URL:** https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685
**Category:** Visualization
**Tags:** question, makie
**Created:** [October 6, 2023, 10:12pm UTC](https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685 "2023-10-06T22:12:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ultradian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ultradian/32/17802_2.png) [@ultradian](https://discourse.julialang.org/u/ultradian)
#### Post date: [October 6, 2023, 10:12pm UTC](https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685/1 "2023-10-06T22:12:05Z")

</div>

How do you align text in a Button? I didn’t see any way to do it in the docs. Only using `valign` and `halign` to align the button in its bbox. In a related question, I tried to change the padding, but didn’t notice an effect.

```julia
f = Figure()
b = Button(f, label="hello", 
    height=400, width=400,
    padding=(0.0f0, 0.0f0, 10.0f0, 10.0f0))
f

```

looks the same to me as

```julia
f = Figure()
b = Button(f, label="hello", 
    height=400, width=400,
    padding=(10.0f0, 10.0f0, 10.0f0, 10.0f0))
f

```

Am I missing something basic?

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [October 7, 2023, 10:56am UTC](https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685/2 "2023-10-07T10:56:23Z")

</div>

Align is not implemented for Button because it’s usually as large as the text needs it to be. Padding should work unless it has regressed…

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [October 7, 2023, 5:29pm UTC](https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685/3 "2023-10-07T17:29:21Z")

</div>

> [@jules](#):
>
> it’s usually as large as the text needs it to be.

If you have multiple buttons next to each other, wouldn’t you want them to be the same size, independent of label size? E.g. “OK” and “Cancel”.

---

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [October 7, 2023, 9:14pm UTC](https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685/4 "2023-10-07T21:14:14Z")

</div>

you can change the size, but not the alignment within I think. could be added of course

---

<div class="post-metadata">

### Author: ![ultradian](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ultradian/32/17802_2.png) [@ultradian](https://discourse.julialang.org/u/ultradian)
#### Post date: [October 18, 2023, 7:24pm UTC](https://discourse.julialang.org/t/makie-how-to-align-text-in-a-button/104685/5 "2023-10-18T19:24:26Z")

</div>

Thanks for the info! I think that is [here](https://github.com/MakieOrg/Makie.jl/blob/619be638dd59c8e16236bba30d149755ad347535/src/makielayout/blocks/button.jl#L36C1-L36C95):

```julia
    labeltext = text!(subscene, textpos, text = b.label, fontsize = b.fontsize, font = b.font,
        color = lcolor, align = (:center, :center), markerspace = :data, inspectable = false)

```

If I can figure out how where the `Button` struct is defined, I could drop a PR. 😁
