Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-evaluate slots and their roles #1777

Open
VividLemon opened this issue Feb 16, 2024 · 2 comments
Open

Re-evaluate slots and their roles #1777

VividLemon opened this issue Feb 16, 2024 · 2 comments
Assignees

Comments

@VividLemon
Copy link
Member

Review the following example from BCard.vue

<BCardFooter
      v-if="footer || hasFooterSlot || footerHtml"
      v-bind="footerAttrs"
      :class="footerClass"
    >
      <slot name="footer">
        {{ footer }}
      </slot>
    </BCardFooter>

In this situation, you have the prop 'footer' & slot 'footer' do the exact same thing.

In this exact situation, you are able to modify BCardFooter with props, but this leaves some things to be desired.

Perhaps it would be better to refactor it as

<slot name="footer">
<BCardFooter
      v-if="footer || hasFooterSlot || footerHtml"
      v-bind="footerAttrs"
      :class="footerClass"
    >
        {{ footer }}
    </BCardFooter>
</slot>

This provides the most flexibility for modifying values. While also preserving an easy way to modify only the text. Should this be implemented? Idk. It would be a deviation from the Bootstrap-vue standard. Some research into how we use slots, what is more common, and how bootstrap-vue uses slots, and what is most common. Then set one standard and go with it.

Copy link
Contributor

This issue is stale because it has been open for 30 days with no activity. It will not be auto-closed

@github-actions github-actions bot added the stale There has been no additional replies or questions and the thread is assumed closed label Mar 18, 2024
@VividLemon VividLemon self-assigned this May 23, 2024
@github-actions github-actions bot removed the stale There has been no additional replies or questions and the thread is assumed closed label May 24, 2024
@cdmoro
Copy link
Contributor

cdmoro commented May 25, 2024

Hey, I think we should leave slots as is, for the following reasons:

  • Backward compatibility, this is something familiar for the bootstrap-vue users, if they decide to move to bs-vue-next they should update the slot logic as well, so this would add a layer of complexity that we don't need atm
  • The point of having a library like this is to emulate Bootstrap, so the Bootstrap card has to have a Bootstrap card footer in the footer place, and not another component.
  • If the user wants to customize the Bootstrap card, they can use HTML elements directly, for instance:
<BCard no-body>
   <BCardBody>
      // Main content
  </BCardBody>
  <div class="card-footer text-body-secondary">
     // Footer content
  </div>
</BCard>

Does it make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants