linebender / linebender/druid

Buttons cannot be customized: Can we make them generic over a containing widget?

Open
#2,159 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

As it stands, the current implementation of `widget::Button` cannot be meaningfully customized. Some things that would be nice:

- Containing other visual cues, such as a icon
- Increasing the size for buttons that are meant to be prominent

Proposal:

The current implementation nests a `Label` but aside from `Button::dynamic()` (which we can keep as its a builder method) doesn't do anything label-specific in layout/paint. What if we made `Button` generic over its contained widget?

That would allow us to keep the button-specific logic we know and love (the hovering, rounded edges, click visuals etc) but enable custom contents as well as some control over sizing.

Happy to send a PR if this works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the current widget::Button implementation and its Label containment, including Button::dynamic(). Determine how the proposed generic contained widget would preserve hovering, rounded edges, click visuals, and sizing while allowing custom contents; done means buttons can contain visual cues and support larger prominent layouts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.