Skip to content

Commit a21c813

Browse files
authored
Style button widgets (#6900)
This pull request introduces improvements to widget customization and UI consistency in the application. The most notable changes are the addition of support for icon classes in widget options, updates to button rendering logic, and enhanced visual consistency for button components. Widget customization enhancements: * Added an optional `iconClass` property to the `IWidgetOptions` interface in `widgets.ts`, allowing widgets to specify custom icons. UI and rendering updates: * Updated `WidgetButton.vue` to render the widget label and, if provided, an icon using the new `iconClass` option. Also standardized button styling and label usage. * Improved button styling in `WidgetRecordAudio.vue` for better visual consistency with other components. <img width="662" height="534" alt="Screenshot 2025-11-25 at 01 36 45" src="https://github.com/user-attachments/assets/43bbe226-07fd-48be-9b98-78b08a726b1b" /> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6900-Style-button-widgets-2b66d73d3650818ebeadd9315a47ba0f) by [Unito](https://www.unito.io)
1 parent df373af commit a21c813

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/lib/litegraph/src/types/widgets.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface IWidgetOptions<TValues = unknown[]> {
3232
/** Optional function to format values for display (e.g., hash → human-readable name) */
3333
getOptionLabel?: (value?: string | null) => string
3434
callback?: IWidget['callback']
35+
iconClass?: string
3536
}
3637

3738
interface IWidgetSliderOptions extends IWidgetOptions<number[]> {

src/renderer/extensions/vueNodes/widgets/components/WidgetButton.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<template>
22
<div class="flex flex-col gap-1">
33
<Button
4+
class="text-base-foreground w-full border-0 bg-component-node-widget-background p-2"
45
v-bind="filteredProps"
5-
:aria-label="widget.name || widget.label"
6+
:aria-label="widget.label"
67
size="small"
8+
:text="true"
79
@click="handleClick"
810
>
9-
<template v-if="widget.name">
10-
{{ widget.name }}
11-
</template>
11+
{{ widget.label ?? widget.name }}
12+
<i v-if="widget.options?.iconClass" :class="widget.options.iconClass" />
1213
</Button>
1314
</div>
1415
</template>

src/renderer/extensions/vueNodes/widgets/components/WidgetRecordAudio.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="relative">
33
<div class="mb-4">
44
<Button
5-
class="text-text-secondary w-full border-0 bg-secondary-background hover:bg-secondary-background-hover"
5+
class="text-base-foreground w-full border-0 bg-secondary-background hover:bg-secondary-background-hover"
66
:disabled="isRecording || readonly"
77
@click="handleStartRecording"
88
>

0 commit comments

Comments
 (0)