diff --git a/docs/content/docs/2.components/tabs.md b/docs/content/docs/2.components/tabs.md index 211ba97e..39b38fed 100644 --- a/docs/content/docs/2.components/tabs.md +++ b/docs/content/docs/2.components/tabs.md @@ -39,6 +39,7 @@ Use the `items` prop as an array of objects with the following properties: - `label?: string`{lang="ts-type"} - [`icon?: IconComponent`{lang="ts-type"}](#usage) - `avatar?: AvatarProps`{lang="ts-type"} +- `color?: AvatarProps['color']`{lang="ts-type"} - `badge?: string | number | BadgeProps`{lang="ts-type"} - `content?: string`{lang="ts-type"} - `value?: string | number`{lang="ts-type"} diff --git a/src/runtime/components/Tabs.vue b/src/runtime/components/Tabs.vue index d8786440..6136962f 100644 --- a/src/runtime/components/Tabs.vue +++ b/src/runtime/components/Tabs.vue @@ -17,6 +17,10 @@ export interface TabsItem { */ icon?: IconComponent avatar?: AvatarProps + /** + * Default `color` for the item's leading `B24Avatar`. Overridden by `avatar.color` when set. + */ + color?: AvatarProps['color'] /** * Display a badge on the item. * `{ size: 'sm', color: 'air-primary' }`{lang="ts-type"} @@ -172,6 +176,7 @@ defineExpose({ { ['with as', { props: { ...props, as: 'section' } }], ['with class', { props: { ...props, class: 'w-96' } }], ['with b24ui', { props: { ...props, b24ui: { content: 'w-full ring ring-red-500' } } }], + ['with item color', { props: { items: [{ label: 'Engineer', avatar: { src: 'https://github.com/bitrix24.png' }, color: 'air-primary' as const, content: 'Engineer content' }, { label: 'Designer', avatar: { src: 'https://github.com/bitrix24.png' }, color: 'air-primary-success' as const, content: 'Designer content' }] } }], // Slots ['with leading slot', { props, slots: { leading: () => 'Leading slot' } }], ['with default slot', { props, slots: { default: () => 'Default slot' } }], diff --git a/test/components/__snapshots__/Tabs-vue.spec.ts.snap b/test/components/__snapshots__/Tabs-vue.spec.ts.snap index 508480fa..e4d7cf98 100644 --- a/test/components/__snapshots__/Tabs-vue.spec.ts.snap +++ b/test/components/__snapshots__/Tabs-vue.spec.ts.snap @@ -200,6 +200,22 @@ exports[`Tabs > renders with defaultValue correctly 1`] = ` " `; +exports[`Tabs > renders with item color correctly 1`] = ` +"
+
+ +
+
Engineer content
+ +
" +`; + exports[`Tabs > renders with items correctly 1`] = ` "
diff --git a/test/components/__snapshots__/Tabs.spec.ts.snap b/test/components/__snapshots__/Tabs.spec.ts.snap index 56ad6915..23d534fd 100644 --- a/test/components/__snapshots__/Tabs.spec.ts.snap +++ b/test/components/__snapshots__/Tabs.spec.ts.snap @@ -200,6 +200,22 @@ exports[`Tabs > renders with defaultValue correctly 1`] = `
" `; +exports[`Tabs > renders with item color correctly 1`] = ` +"
+
+ +
+
Engineer content
+ +
" +`; + exports[`Tabs > renders with items correctly 1`] = ` "