diff --git a/package.json b/package.json index e5aa21ec..e5acbedb 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "typescript": "^5.0.2" }, "peerDependencies": { - "vue": ">=3.3.0", + "vue": ">=3.5.0", "vue-router": "^4.1.6" }, "devDependencies": { diff --git a/src/components/ListView.story.md b/src/components/ListView/ListView.story.md similarity index 100% rename from src/components/ListView.story.md rename to src/components/ListView/ListView.story.md diff --git a/src/components/ListView.story.vue b/src/components/ListView/ListView.story.vue similarity index 94% rename from src/components/ListView.story.vue rename to src/components/ListView/ListView.story.vue index 929e548b..97d6394c 100644 --- a/src/components/ListView.story.vue +++ b/src/components/ListView/ListView.story.vue @@ -1,17 +1,16 @@ diff --git a/src/components/Tabs.story.md b/src/components/Tabs.story.md deleted file mode 100644 index f9d3a9a7..00000000 --- a/src/components/Tabs.story.md +++ /dev/null @@ -1,15 +0,0 @@ -## Props - -### Tabs - -It is an array of objects which contains the following attributes: - -1. `label` is the name of the tab, it is required. -2. `icon` is the icon to be shown in the tab, it accept component and it is - optional. -3. You can add more attributes which can be used for custom rendering in the tab - header or content. - -## v-model - -It is used to set the active tab or change the active tab. It is required. diff --git a/src/components/Tabs.vue b/src/components/Tabs.vue deleted file mode 100644 index e8f3ce41..00000000 --- a/src/components/Tabs.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - diff --git a/src/components/Tabs/TabList.vue b/src/components/Tabs/TabList.vue new file mode 100644 index 00000000..5eb943a7 --- /dev/null +++ b/src/components/Tabs/TabList.vue @@ -0,0 +1,81 @@ + + diff --git a/src/components/Tabs/TabPanel.vue b/src/components/Tabs/TabPanel.vue new file mode 100644 index 00000000..071e18f0 --- /dev/null +++ b/src/components/Tabs/TabPanel.vue @@ -0,0 +1,17 @@ + + diff --git a/src/components/Tabs/Tabs.story.md b/src/components/Tabs/Tabs.story.md new file mode 100644 index 00000000..12e22297 --- /dev/null +++ b/src/components/Tabs/Tabs.story.md @@ -0,0 +1,97 @@ +## Props + +### tabs + +It is an array of objects which contains the following attributes: + +1. `label` is the name of the tab, it is required. +2. `icon` is the icon to be shown in the tab, it accept component and it is + optional. +3. You can add more attributes which can be used for custom rendering in the tab + header or content. + +### v-model + +It is used to set the active tab or change the active tab. It is required. + +### vertical + +It is used to show the tabs vertically. It is optional. + +### as + +You can set it to `div` to wrap tabs in a `div`. It can be any valid HTML tag. +This is useful to control the layout of the tabs. It is optional. + +1. `as="div"` or any valid HTML tag + +```html +
+ +
+
Tab 1
+
Tab 2
+
Tab 3
+
+
+
Content 1
+
Content 2
+
Content 3
+
+
+``` + +2. `as` is not set + +```html +
+
Tab 1
+
Tab 2
+
Tab 3
+
+
+
Content 1
+
Content 2
+
Content 3
+
+``` + +## Slots + +1. **tab-item:** You can use this slot to render custom tab items. It is + optional. +2. **tab-panel:** You can use this slot to render custom tab panels. It is + required. Example: + +```vue + + + + +``` + +## Layout Customization + +You can customize the layout of the tabs by using `` and `` +components. + +```vue + + +
+ {{ tab.label }} + {{ tab.icon }} +
+
+ +
{{ tab.content }}
+
+
+``` diff --git a/src/components/Tabs.story.vue b/src/components/Tabs/Tabs.story.vue similarity index 69% rename from src/components/Tabs.story.vue rename to src/components/Tabs/Tabs.story.vue index 71d8e404..d8fdb395 100644 --- a/src/components/Tabs.story.vue +++ b/src/components/Tabs/Tabs.story.vue @@ -1,7 +1,7 @@ diff --git a/src/index.js b/src/index.js index fea12dbf..fb2d2367 100644 --- a/src/index.js +++ b/src/index.js @@ -32,7 +32,9 @@ export { default as Select } from './components/Select.vue' export { default as Spinner } from './components/Spinner.vue' export { default as Switch } from './components/Switch.vue' export { default as TabButtons } from './components/TabButtons.vue' -export { default as Tabs } from './components/Tabs.vue' +export { default as Tabs } from './components/Tabs/Tabs.vue' +export { default as TabList } from './components/Tabs/TabList.vue' +export { default as TabPanel } from './components/Tabs/TabPanel.vue' export { default as TextInput } from './components/TextInput.vue' export { default as Textarea } from './components/Textarea.vue' export {