-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ContextMenu/DropdownMenu): handle
checkbox
items type
Resolves #2144
- Loading branch information
1 parent
0759e29
commit 8ef6e71
Showing
9 changed files
with
465 additions
and
350 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
docs/app/components/content/examples/context-menu/ContextMenuCheckboxItemsExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script setup lang="ts"> | ||
const showSidebar = ref(true) | ||
const showToolbar = ref(false) | ||
const items = computed(() => [{ | ||
label: 'View', | ||
type: 'label' as const | ||
}, { | ||
type: 'separator' as const | ||
}, { | ||
label: 'Show Sidebar', | ||
type: 'checkbox' as const, | ||
checked: showSidebar.value, | ||
onUpdateChecked(checked: boolean) { | ||
showSidebar.value = checked | ||
}, | ||
onSelect(e?: Event) { | ||
e?.preventDefault() | ||
} | ||
}, { | ||
label: 'Show Toolbar', | ||
type: 'checkbox' as const, | ||
checked: showToolbar.value, | ||
onUpdateChecked(checked: boolean) { | ||
showToolbar.value = checked | ||
} | ||
}, { | ||
label: 'Collapse Pinned Tabs', | ||
type: 'checkbox' as const, | ||
disabled: true | ||
}]) | ||
</script> | ||
|
||
<template> | ||
<UContextMenu :items="items" class="w-48"> | ||
<div class="flex items-center justify-center rounded-md border border-dashed border-[var(--ui-border-accented)] text-sm aspect-video w-72"> | ||
Right click here | ||
</div> | ||
</UContextMenu> | ||
</template> |
46 changes: 46 additions & 0 deletions
46
docs/app/components/content/examples/dropdown-menu/DropdownMenuCheckboxItemsExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script setup lang="ts"> | ||
const showBookmarks = ref(true) | ||
const showHistory = ref(false) | ||
const showDownloads = ref(false) | ||
const items = computed(() => [{ | ||
label: 'Interface', | ||
icon: 'i-heroicons-window', | ||
type: 'label' as const | ||
}, { | ||
type: 'separator' as const | ||
}, { | ||
label: 'Show Bookmarks', | ||
icon: 'i-heroicons-bookmark', | ||
type: 'checkbox' as const, | ||
checked: showBookmarks.value, | ||
onUpdateChecked(checked: boolean) { | ||
showBookmarks.value = checked | ||
}, | ||
onSelect(e?: Event) { | ||
e?.preventDefault() | ||
} | ||
}, { | ||
label: 'Show History', | ||
icon: 'i-heroicons-clock', | ||
type: 'checkbox' as const, | ||
checked: showHistory.value, | ||
onUpdateChecked(checked: boolean) { | ||
showHistory.value = checked | ||
} | ||
}, { | ||
label: 'Show Downloads', | ||
icon: 'i-heroicons-arrow-down-on-square', | ||
type: 'checkbox' as const, | ||
checked: showDownloads.value, | ||
onUpdateChecked(checked: boolean) { | ||
showDownloads.value = checked | ||
} | ||
}]) | ||
</script> | ||
|
||
<template> | ||
<UDropdownMenu :items="items" :content="{ align: 'start' }" class="w-48"> | ||
<UButton label="Open" color="neutral" variant="outline" icon="i-heroicons-bars-3" /> | ||
</UDropdownMenu> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.