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

feat(VList): add prependSpacer prop #20616

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Oct 25, 2024

Description

Markup:

<template>
  <v-card class="mx-auto" width="300">
    <v-list v-model:opened="open">
      <v-list-item prepend-icon="mdi-home" title="Home"></v-list-item>

      <v-list-group prepend-icon="mdi-home" value="Users">
        <template v-slot:activator="{ props }">
          <v-list-item
            v-bind="props"
            prepend-icon="mdi-account-circle"
            title="Users"
          ></v-list-item>
        </template>

        <v-list-group value="Admin">
          <template v-slot:activator="{ props }">
            <v-list-item v-bind="props"
            title="Admin"></v-list-item>
          </template>

          <v-list-item
            v-for="([title, icon], i) in admins"
            :key="i"
            :prepend-icon="icon"
            :title="title"
            :value="title"
          ></v-list-item>
        </v-list-group>

        <v-list-group value="Actions">
          <template v-slot:activator="{ props }">
            <v-list-item v-bind="props" title="Actions"></v-list-item>
          </template>

          <v-list-item
            v-for="([title, icon], i) in cruds"
            :key="i"
            :prepend-icon="icon"
            :title="title"
            :value="title"
          ></v-list-item>
        </v-list-group>
      </v-list-group>
    </v-list>
  </v-card>
</template>

<script>
  export default {
    data: () => ({
      open: ['Users'],
      admins: [
        ['Management', 'mdi-account-multiple-outline'],
        ['Settings', 'mdi-cog-outline'],
      ],
      cruds: [
        ['Create', 'mdi-plus-outline'],
        ['Read', 'mdi-file-outline'],
        ['Update', 'mdi-update'],
        ['Delete', 'mdi-delete'],
      ],
    }),
  }
</script>


@yuwu9145 yuwu9145 marked this pull request as ready for review October 25, 2024 11:37
@yuwu9145
Copy link
Member Author

Does it make it too complex to reduce the spacing between parent/child as well?

Setting sass variable$list-indent-size to 0 makes it look much better. But I need to do some more work to figure out any potential breaking changes if we do that

@MajesticPotatoe MajesticPotatoe added T: feature A new feature C: VList VList labels Oct 28, 2024
@yuwu9145 yuwu9145 marked this pull request as draft November 2, 2024 12:31
@yuwu9145
Copy link
Member Author

yuwu9145 commented Nov 5, 2024

FYI: I'm still trying to fix the indent issue.

It's a complicated one but I found the problem, it's the --prepend css modifier applied incorrectly in nested scenario. Trying to find a solution atm

@yuwu9145
Copy link
Member Author

yuwu9145 commented Nov 13, 2024

Did regression testing on docs (VTreeview & VList), all good. But there is one caveat:

Indent only works properly if prepend-icon is provided in v-list-group rather than in its activator v-list-item.

✅ Works

<v-list-group
  prepend-icon="mdi-home"
  value="Admin"
>
   <template v-slot:activator="{ props }">
       <v-list-item
           v-bind="props"
            title="Admin"
        ></v-list-item>
    </template>
</v-list-group>

❌ Doesn't work

<v-list-group
  value="Admin"
>
   <template v-slot:activator="{ props }">
       <v-list-item
           v-bind="props"
           prepend-icon="mdi-home"
           title="Admin"
        ></v-list-item>
    </template>
</v-list-group>

Making the latter sample work requires js logic (to somehow access activator slot), but I would rather keep everything in css unless the latter use case is desperately required

@yuwu9145 yuwu9145 marked this pull request as ready for review November 13, 2024 10:25
@johnleider
Copy link
Member

Did regression testing on docs (VTreeview & VList), all good. But there is one caveat:

Indent only works properly if prepend-icon is provided in v-list-group rather than in its activator v-list-item.

✅ Works

<v-list-group
  prepend-icon="mdi-home"
  value="Admin"
>
   <template v-slot:activator="{ props }">
       <v-list-item
           v-bind="props"
            title="Admin"
        ></v-list-item>
    </template>
</v-list-group>

❌ Doesn't work

<v-list-group
  value="Admin"
>
   <template v-slot:activator="{ props }">
       <v-list-item
           v-bind="props"
           prepend-icon="mdi-home"
           title="Admin"
        ></v-list-item>
    </template>
</v-list-group>

Making the latter sample work requires js logic (to somehow access activator slot), but I would rather keep everything in css unless the latter use case is desperately required

Can we add a Alert in the docs about it?

@yuwu9145
Copy link
Member Author

Can we add a Alert in the docs about it?

Done, this PR is ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VList VList T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants