# Editing a button text

**URL:** <https://forums.realmacsoftware.com/t/editing-a-button-text/44814>\
**Category:** RapidWeaver Elements\
**Created:** [October 2, 2024, 2:09am UTC](https://forums.realmacsoftware.com/t/editing-a-button-text/44814 "2024-10-02T02:09:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bill](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/bill/32/107_2.png) [@Bill](https://forums.realmacsoftware.com/u/Bill)\
**Post date:** [October 2, 2024, 2:09am UTC](https://forums.realmacsoftware.com/t/editing-a-button-text/44814/1 "2024-10-02T02:09:43Z")

</div>

I’m trying some code to allow editing of button text:

`<a href="https://www.apple.com"><button class="mybutton text-center">@text("button", default: "Button Text")</button></a>`

Clicking to edit the button text isn’t very easy, would be nice if single click would insert cursor wherever in the text we click.

---

<div class="post-metadata">

**Author:** ![dan](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dan/32/28516_2.png) [@dan](https://forums.realmacsoftware.com/u/dan)\
**Post date:** [October 2, 2024, 12:18pm UTC](https://forums.realmacsoftware.com/t/editing-a-button-text/44814/2 "2024-10-02T12:18:03Z")

</div>

We’ll see what we can do, although it might be tricky to get it just right as often you want to just highlight (or drag) the Component, not edit the text 🧐

As aside note: I see in your example you’re using a custom class of “mybutton” - you really _need_ to be using tailwind classes. I know you are probably just messing around with things, but you _really_ need to lean into using Tailwind!

Here’s some code for a button…

```auto
<button class="bg-brand-500 hover:bg-brand-700 text-text-900 font-heading text-xl py-2 px-4 rounded">
  Simple Button
</button>

```

And by using the Tailwind classes, it gives you a nice button that uses the built-in theme studio (colours and font), and this means users have a unified way of controlling its look.

Just something to keep in mind!

---

<div class="post-metadata">

**Author:** ![Bill](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/bill/32/107_2.png) [@Bill](https://forums.realmacsoftware.com/u/Bill)\
**Post date:** [October 2, 2024, 4:32pm UTC](https://forums.realmacsoftware.com/t/editing-a-button-text/44814/3 "2024-10-02T16:32:08Z")

</div>

When clicking on an @text element - definitely want to edit it.  
Don’t worry about classes in my examples I’m trying to keep code simple to focus you in on the problem 😉

Oh, might as well mention again that @text really needs to be raw text only as using it on any other tags mutates p tags in there which is not good.

---

<div class="post-metadata">

**Author:** ![dan](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dan/32/28516_2.png) [@dan](https://forums.realmacsoftware.com/u/dan)\
**Post date:** [October 2, 2024, 4:38pm UTC](https://forums.realmacsoftware.com/t/editing-a-button-text/44814/4 "2024-10-02T16:38:52Z")

</div>

> [@Bill](#):
>
> Oh, might as well mention again that @text really needs to be raw text only as using it on any other tags mutates p tags in there which is not good.

We’re working on the text editing engine, look out for some big improvements in the coming weeks.
