Simple actions menu with AList
See original GitHub issueI want to build a simple actions menu, but using AList
is not relevant as we can’t handle click on each list items.
How to do that ?
Here is my code :
<script lang="ts" setup>
import { ref } from 'vue'
const items = [
{ title: 'Send' },
{ title: 'Edit' },
{ title: 'Delete' },
]
const selected = ref(0)
watch(selected, () => {
console.log(selected.value)
// We should handle value with item index ?
})
</script>
<template>
<ABtn variant="text" class="!text-gray" icon="i-bi-three-dots-vertical" icon-only>
<AMenu
trigger="hover"
placement="bottom-end"
>
<AList
v-model="selected"
:items="items"
class="[--a-list-gap:0.25rem]"
/>
</AMenu>
</ABtn>
</template>
Also, item 0
is selected at mount time. I don’t want that.
If I use const selected = ref()
, hovering item don’t trigger background overlay.
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Defining a list actions menu - IBM
Defining a list actions menu. Add a list actions menu to a person page. A list actions menu contains a set of actions...
Read more >Use list actions in Shortcuts on iPhone or iPad - Apple Support
Use the List action to create an ordered list of content, by entering text or by inserting variables. When the shortcut is run,...
Read more >Building a menu using List - a free SwiftUI by Example tutorial
In our app this screen will show us a list of items from a menu, so we're going to use a List view...
Read more >Menus - Android Developers
The options menu is the primary collection of menu items for an activity. It's where you should place actions that have a global...
Read more >Menus - Components - Material Design
Menus appear upon interaction with a button, action, or other control. They display a list of choices, with one choice per line. Menu...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome ! You made a lot of works 🚀 It simplify a lot the process. So, I’ve been rewriting my simple menu with this :
I can get it worked, but we must add custom
class
or an arbitraryvalue
attribute to display the list item with the cursor pointer and to be highlighted on hover. It’s not very intuitive…Yes, everything seems good to me now !
This works as expected: