Danilo Leal
4e8937b62d
ui: Refactor the Button component icon methods ( #51496 )
...
Previously, if you wanted to have a button that contains icons on both
edges, you'd need to use a `ButtonLike` component, which takes any
children. Meanwhile, the `Button` would only take one icon, where you
could control its position through the `IconPosition` enum. This has
always felt unnecessarily limiting. So, this PR removes this limitation
by adding two new methods to the button: `start_icon` and `end_icon`.
In the meantime, I have also been bothered by the unnecessary
indirection in the `IconButton` due to the existence of the `ButtonIcon`
component. So I figured I could also completely eliminate that by adding
some of its methods directly to the `IconButton` and in the Button, just
using a regular `Icon` component.
---
## Before
```rust
Button::new("id", "Label")
.icon(IconName::Plus)
.icon_position(IconPosition::Start)
.icon_size(IconSize::Small)
.icon_color(Color::Muted)
```
## After
```rust
Button::new("id", "Label")
.start_icon(Icon::new(IconName::Check))
.end_icon(Icon::new(IconName::ChevronDown).size(IconSize::XSmall))
```
This should have no visual impact to the UI.
Release Notes:
- N/A
2026-03-13 14:13:12 -03:00
..
2026-03-11 12:52:03 +00:00
2026-01-21 13:40:42 -03:00
2026-03-11 14:52:57 +00:00
2026-03-09 13:22:12 +01:00
2026-03-12 10:14:10 -03:00
2026-03-13 12:27:13 +00:00
2026-03-12 10:14:10 -03:00
2026-03-13 14:13:12 -03:00
2026-03-11 23:21:57 +00:00
2026-03-09 13:22:12 +01:00
2026-02-18 12:00:02 +01:00
2026-01-26 23:56:55 +00:00
2026-02-06 20:14:35 +01:00
2026-03-10 15:23:49 +00:00
2026-03-09 20:50:52 +01:00
2026-03-09 10:10:42 +00:00
2026-03-03 17:47:35 +01:00
2026-02-19 10:41:16 -03:00
2026-02-19 07:23:27 +01:00
2026-03-13 08:00:22 +00:00
2026-03-09 13:22:12 +01:00
2026-03-09 13:22:12 +01:00
2026-03-13 07:48:35 +00:00
2026-03-06 19:18:33 +00:00
2026-03-11 22:22:17 +00:00
2026-02-25 08:12:04 +01:00
2026-03-04 15:45:33 +01:00
2026-03-11 22:22:17 +00:00
2026-03-09 13:22:12 +01:00
2026-03-09 19:58:31 -04:00
2026-03-13 08:00:22 +00:00
2026-03-13 14:13:12 -03:00
2026-03-09 13:22:12 +01:00
2026-02-19 18:57:49 +01:00
2026-01-30 21:26:13 +00:00
2026-03-10 13:55:57 -05:00
2026-03-08 09:34:46 +00:00
2026-03-13 14:13:12 -03:00
2026-03-11 03:08:39 +00:00
2026-01-07 12:48:24 -08:00
2026-03-03 15:49:40 +01:00
2026-03-09 13:22:12 +01:00
2026-02-13 20:16:11 +01:00
2026-02-12 16:26:13 +00:00
2026-01-14 07:19:13 +00:00
2026-02-18 12:00:02 +01:00
2026-03-13 14:13:12 -03:00
2025-12-18 12:47:34 +00:00
2026-03-09 13:22:12 +01:00
2026-03-12 18:25:52 +02:00
2026-03-04 15:38:31 +01:00
2026-03-13 09:01:42 -04:00
2026-03-10 13:43:27 +02:00
2026-03-09 13:22:12 +01:00
2026-02-04 17:54:11 -05:00
2026-03-13 14:13:12 -03:00
2026-03-13 16:27:01 +00:00
2026-02-12 00:28:17 +00:00
2026-02-28 21:47:30 -05:00
2026-03-06 19:15:21 +00:00
2026-03-10 17:04:48 +01:00
2026-02-19 18:57:49 +01:00
2026-02-28 22:42:19 -05:00
2026-03-09 11:47:12 +01:00
2026-03-07 11:05:10 +01:00
2026-03-09 11:47:12 +01:00
2026-03-09 13:22:12 +01:00
2026-03-13 14:13:12 -03:00
2026-03-11 03:08:39 +00:00
2026-03-09 13:22:12 +01:00
2026-03-13 16:52:50 +00:00
2026-03-13 14:53:14 +00:00
2026-02-19 18:57:49 +01:00
2025-12-08 19:50:20 +01:00
2026-03-13 14:53:14 +00:00
2026-03-13 14:13:12 -03:00
2026-01-31 21:56:34 +00:00
2026-03-13 14:13:12 -03:00
2026-03-09 15:50:44 +00:00
2026-03-04 15:53:26 +00:00
2026-03-13 01:58:57 +00:00
2026-03-13 21:16:56 +05:30
2026-03-12 22:15:12 +00:00
2026-03-06 14:03:45 +00:00
2026-03-12 22:15:12 +00:00
2026-01-07 12:48:24 -08:00
2026-02-26 18:36:50 +01:00
2026-03-07 04:11:45 +00:00
2026-03-05 22:59:48 -07:00
2026-03-08 04:54:05 +00:00
2026-03-04 15:45:33 +01:00
2026-03-12 14:05:30 -03:00
2026-03-13 08:00:22 +00:00
2026-02-20 08:32:45 +00:00
2026-02-12 00:28:17 +00:00
2026-03-12 15:34:09 -07:00
2026-03-07 11:05:10 +01:00
2026-03-13 14:13:12 -03:00
2026-03-10 13:55:57 -05:00
2026-03-07 11:05:10 +01:00
2026-03-12 22:49:17 +00:00
2026-03-13 14:13:12 -03:00
2026-03-13 14:13:12 -03:00
2026-02-26 15:18:25 +00:00
2026-03-13 14:13:12 -03:00
2026-03-12 13:24:51 +01:00
2026-02-03 15:51:40 -05:00
2026-03-11 20:26:19 +01:00
2026-03-06 16:49:55 +00:00
2026-03-04 18:54:23 +00:00
2026-03-05 14:00:08 +00:00
2026-03-06 17:23:50 +01:00
2025-12-30 07:49:01 -03:00
2026-03-04 20:29:20 +00:00
2026-03-04 19:13:32 +01:00
2026-03-05 08:59:05 +00:00
2026-03-10 15:23:49 +00:00
2026-02-17 10:41:10 +00:00
2026-02-20 13:36:04 +00:00
2026-02-13 20:16:11 +01:00
2026-03-09 13:22:12 +01:00
2026-02-16 14:33:29 +00:00
2026-03-13 14:13:12 -03:00
2026-03-09 13:51:22 +00:00
2026-03-13 16:52:50 +00:00
2026-02-12 14:02:16 +00:00
2026-03-09 13:22:12 +01:00
2026-03-09 15:50:44 +00:00
2026-03-13 14:13:12 -03:00
2026-03-02 22:18:49 +00:00
2026-03-05 18:59:01 +00:00
2026-03-12 21:16:48 +05:30
2026-02-07 00:36:37 +00:00
2026-03-13 11:09:37 +00:00
2026-02-19 18:57:49 +01:00
2026-03-13 15:25:54 +00:00
2026-02-12 01:06:23 +00:00
2026-01-30 21:26:13 +00:00
2026-03-12 17:53:38 +00:00
2026-03-13 14:13:12 -03:00
2025-12-15 13:30:13 +00:00
2025-11-27 13:46:43 +00:00
2026-03-02 23:31:11 -07:00
2026-02-02 13:30:07 +01:00
2026-03-10 17:32:51 +00:00
2026-03-13 14:13:12 -03:00
2026-03-09 13:22:12 +01:00
2026-03-09 08:35:19 +00:00
2026-02-11 21:30:03 +02:00
2026-03-13 14:13:12 -03:00
2026-03-07 04:11:45 +00:00
2025-12-16 10:48:14 -05:00
2026-03-13 14:13:12 -03:00
2026-02-12 01:06:23 +00:00
2026-03-13 15:25:54 +00:00
2026-03-13 16:52:50 +00:00
2026-03-09 13:22:12 +01:00
2026-03-13 14:13:12 -03:00
2026-02-18 13:01:01 -05:00
2026-01-26 13:49:26 +00:00
2026-02-12 00:28:17 +00:00
2026-03-10 20:25:12 +00:00
2026-02-19 18:57:49 +01:00
2026-03-06 14:03:45 +00:00
2026-03-10 15:23:49 +00:00
2026-03-09 13:22:12 +01:00
2026-03-09 11:47:12 +01:00
2026-03-11 15:05:22 +00:00
2026-01-28 16:36:44 -08:00
2026-03-09 13:22:12 +01:00
2026-03-13 08:00:22 +00:00
2026-03-09 13:22:12 +01:00
2026-03-12 21:35:42 +02:00
2026-02-26 12:01:57 +00:00
2026-03-13 14:13:12 -03:00
2026-02-28 21:47:30 -05:00
2026-03-13 14:13:12 -03:00
2026-02-18 17:07:10 -05:00
2026-03-13 14:13:12 -03:00
2026-02-02 13:30:07 +01:00
2026-03-10 06:57:43 +00:00
2026-01-25 21:35:32 +01:00
2026-03-12 19:05:28 +00:00
2026-03-09 13:22:12 +01:00
2026-03-12 22:49:17 +00:00
2025-12-17 11:53:48 -07:00
2026-03-13 14:13:12 -03:00
2026-03-13 11:09:37 +00:00
2026-02-19 18:57:49 +01:00
2026-03-04 17:36:25 +01:00
2026-03-12 22:43:34 +00:00
2026-03-12 21:35:42 +02:00
2025-12-13 11:06:30 -05:00
2026-03-12 16:56:37 -04:00
2026-03-03 08:37:58 +00:00
2026-02-11 11:24:04 +00:00
2025-12-05 17:23:06 +00:00