Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/runtime/components/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export interface ButtonProps extends UseComponentIconsProps, Omit<LinkProps, 'ra
}

export interface ButtonSlots {
leading(props?: {}): any
leading(props?: { ui: Button['slots'] }): any
default(props?: {}): any
trailing(props?: {}): any
trailing(props?: { ui: Button['slots'] }): any
Comment on lines +38 to +40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need this to have correct types:

Suggested change
leading(props?: { ui: Button['slots'] }): any
default(props?: {}): any
trailing(props?: {}): any
trailing(props?: { ui: Button['slots'] }): any
leading(props: { ui: { [K in keyof Required<Button['slots']>]: (props?: Record<string, any>) => string } }): any
default(props?: {}): any
trailing(props: { ui: { [K in keyof Required<Button['slots']>]: (props?: Record<string, any>) => string } }): any

}
</script>

Expand Down Expand Up @@ -132,7 +132,7 @@ const ui = computed(() => tv({
})"
@click="onClickWrapper"
>
<slot name="leading">
<slot name="leading" :ui="ui">
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon, active })" />
<UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar, active })" />
</slot>
Expand All @@ -143,7 +143,7 @@ const ui = computed(() => tv({
</span>
</slot>

<slot name="trailing">
<slot name="trailing" :ui="ui">
<UIcon v-if="isTrailing && trailingIconName" :name="trailingIconName" :class="ui.trailingIcon({ class: props.ui?.trailingIcon, active })" />
</slot>
</ULinkBase>
Expand Down
Loading