Skip to content

u-banner to show actions slot without actions prop #4944

@IlyaSemenov

Description

@IlyaSemenov

Package

v4.0.0-alpha.x

Description

Currently, u-banner only shows the actions slots if there is non-empty actions array. That leads to unwanted boilerplate with unused arrays just for the sake of it:

u-banner(title="Transaction pending" :actions="[{}]")
  template(#actions)
    u-button Sign

Above, the :actions="[{}]" serves no purpose other than to satisfy the condition inside u-banner:

<div v-if="actions?.length" :class="ui.actions({ class: props.ui?.actions })">
  <slot name="actions">
    <UButton v-for="(action, index) in actions" :key="index" color="neutral" size="xs" v-bind="action" />
  </slot>
</div>

What I propose it, change it like this:

<div v-if="actions?.length || $slots.actions" ...

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesttriageAwaiting initial review and prioritizationv4#4488

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions