From e8eb3941ad4c1c306ccbe9e11d979d5f6c808330 Mon Sep 17 00:00:00 2001 From: Abel Derderian Date: Tue, 23 Jul 2024 14:36:03 +0200 Subject: [PATCH] feat(Tabs): handle `icon` in items (#1798) Co-authored-by: Benjamin Canac --- .../content/examples/TabsExampleBasic.vue | 3 +++ .../content/examples/TabsExampleChange.vue | 3 +++ .../examples/TabsExampleDefaultSlot.vue | 8 +------ .../content/examples/TabsExampleIconSlot.vue | 23 +++++++++++++++++++ .../content/examples/TabsExampleIndex.vue | 3 +++ .../content/examples/TabsExampleVModel.vue | 3 +++ .../content/examples/TabsExampleVertical.vue | 3 +++ docs/content/2.components/tabs.md | 9 ++++++++ src/runtime/components/navigation/Tabs.vue | 10 ++++++++ src/runtime/types/tabs.ts | 1 + src/runtime/ui.config/navigation/tabs.ts | 3 ++- 11 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 docs/components/content/examples/TabsExampleIconSlot.vue diff --git a/docs/components/content/examples/TabsExampleBasic.vue b/docs/components/content/examples/TabsExampleBasic.vue index d2357ea7..fd24dabb 100644 --- a/docs/components/content/examples/TabsExampleBasic.vue +++ b/docs/components/content/examples/TabsExampleBasic.vue @@ -1,13 +1,16 @@ diff --git a/docs/components/content/examples/TabsExampleChange.vue b/docs/components/content/examples/TabsExampleChange.vue index d893e7e7..7c3dcb74 100644 --- a/docs/components/content/examples/TabsExampleChange.vue +++ b/docs/components/content/examples/TabsExampleChange.vue @@ -1,12 +1,15 @@ + + diff --git a/docs/components/content/examples/TabsExampleIndex.vue b/docs/components/content/examples/TabsExampleIndex.vue index 1482d147..e75a4477 100644 --- a/docs/components/content/examples/TabsExampleIndex.vue +++ b/docs/components/content/examples/TabsExampleIndex.vue @@ -1,12 +1,15 @@ diff --git a/docs/components/content/examples/TabsExampleVModel.vue b/docs/components/content/examples/TabsExampleVModel.vue index 97c690b4..581f32be 100644 --- a/docs/components/content/examples/TabsExampleVModel.vue +++ b/docs/components/content/examples/TabsExampleVModel.vue @@ -1,12 +1,15 @@ diff --git a/docs/content/2.components/tabs.md b/docs/content/2.components/tabs.md index d4747765..f9b19def 100644 --- a/docs/content/2.components/tabs.md +++ b/docs/content/2.components/tabs.md @@ -11,6 +11,7 @@ links: Pass an array to the `items` prop of the Tabs component. Each item can have the following properties: - `label` - The label of the item. +- `icon` - The icon of the item. - `slot` - A key to customize the item with a slot. - `content` - The content to display in the panel by default. - `disabled` - Determines whether the item is disabled or not. @@ -91,6 +92,14 @@ Use the `#default` slot to customize the content of the trigger buttons. You wil :component-example{component="tabs-example-default-slot"} + +### `icon` + +Use the `#icon` slot to customize the icon of the trigger buttons. You will have access to the `item`, `index`, `selected` and `disabled` in the slot scope. + +:component-example{component="tabs-example-icon-slot"} + + ### `item` Use the `#item` slot to customize the items content. You will have access to the `item`, `index` and `selected` properties in the slot scope. diff --git a/src/runtime/components/navigation/Tabs.vue b/src/runtime/components/navigation/Tabs.vue index 0504edf6..0eba9191 100644 --- a/src/runtime/components/navigation/Tabs.vue +++ b/src/runtime/components/navigation/Tabs.vue @@ -25,6 +25,16 @@ as="template" >