+
@@ -46,6 +50,7 @@
diff --git a/projects/kit/components/tabs/tabs.directive.ts b/projects/kit/components/tabs/tabs.directive.ts
index f76dc539ef25..a3f18537e85a 100644
--- a/projects/kit/components/tabs/tabs.directive.ts
+++ b/projects/kit/components/tabs/tabs.directive.ts
@@ -9,17 +9,25 @@ import {
Output,
} from '@angular/core';
import {tuiMoveFocus, tuiWithStyles} from '@taiga-ui/cdk';
+import type {TuiSizeL} from '@taiga-ui/core';
import {TUI_TAB_ACTIVATE} from './tab.directive';
import {TuiTabsComponent} from './tabs.component';
+import {TUI_TABS_OPTIONS} from './tabs.options';
@Directive({
standalone: true,
selector: 'tui-tabs:is(never)',
+ host: {
+ '[attr.data-size]': 'size',
+ },
})
export class TuiTabsDirective implements AfterViewChecked {
private readonly el: HTMLElement = inject(ElementRef).nativeElement;
+ @Input()
+ public size: TuiSizeL = inject(TUI_TABS_OPTIONS).size;
+
@Input()
public activeItemIndex = 0;
diff --git a/projects/kit/components/tabs/tabs.options.ts b/projects/kit/components/tabs/tabs.options.ts
index b174ab94f490..d6a9c3d8c409 100644
--- a/projects/kit/components/tabs/tabs.options.ts
+++ b/projects/kit/components/tabs/tabs.options.ts
@@ -1,11 +1,13 @@
import type {Provider} from '@angular/core';
import {tuiCreateToken, tuiProvideOptions} from '@taiga-ui/cdk';
+import type {TuiSizeL} from '@taiga-ui/core';
export interface TuiTabsOptions {
readonly exposeActive: boolean;
readonly itemsLimit: number;
readonly minMoreWidth: number;
readonly underline: boolean | string;
+ readonly size: TuiSizeL;
}
export const TUI_TABS_DEFAULT_OPTIONS: TuiTabsOptions = {
@@ -13,6 +15,7 @@ export const TUI_TABS_DEFAULT_OPTIONS: TuiTabsOptions = {
exposeActive: true,
itemsLimit: Infinity,
minMoreWidth: 0,
+ size: 'l',
};
/**
diff --git a/projects/kit/components/tabs/tabs.style.less b/projects/kit/components/tabs/tabs.style.less
index 959a64542a67..5075b35d189a 100644
--- a/projects/kit/components/tabs/tabs.style.less
+++ b/projects/kit/components/tabs/tabs.style.less
@@ -1,5 +1,67 @@
@import '@taiga-ui/core/styles/taiga-ui-local';
+[tuiTab] {
+ .transition(~'color, box-shadow, opacity, background');
+ .clearbtn();
+
+ position: relative;
+ display: flex;
+ flex-shrink: 0;
+ box-sizing: border-box;
+ justify-content: space-between;
+ line-height: 1.5rem;
+ align-items: center;
+ white-space: nowrap;
+ cursor: pointer;
+ outline: none;
+ color: inherit;
+ /* stylelint-disable-next-line */
+ margin-left: 24px;
+
+ tui-tabs[data-size='m'] + &,
+ tui-tabs[data-size='m'] &,
+ [tuiTabs][data-size='m'] & {
+ margin-left: 16px;
+ font: var(--tui-font-text-s);
+ }
+
+ &:disabled {
+ opacity: var(--tui-disabled-opacity);
+ pointer-events: none;
+ }
+
+ &._active {
+ color: var(--tui-text-01);
+ box-shadow: none;
+ }
+
+ &:focus-visible {
+ outline: 2px solid var(--tui-focus);
+ outline-offset: -2px;
+ }
+
+ tui-tabs._underline &:hover:not(._active),
+ [tuiTabs]._underline &:hover:not(._active) {
+ box-shadow: inset 0 -2px var(--tui-base-03);
+ }
+
+ tui-tabs > &:first-child,
+ [tuiTabs] > &:first-child,
+ tui-tabs > :not(.t-overflown) > &:first-child {
+ margin-left: 0;
+ }
+
+ tui-tabs > [tuiTab] ~ :not(.t-overflown) > &:first-child {
+ margin-left: var(--tui-tab-margin, 1.5rem);
+ }
+
+ @media (hover: hover) {
+ &:hover {
+ color: var(--tui-text-01);
+ }
+ }
+}
+
[tuiTabs],
tui-tabs {
.scrollbar-hidden();
@@ -12,11 +74,14 @@ tui-tabs {
overflow: auto;
isolation: isolate;
- // TODO: Sizes
- &:not([data-vertical]) {
+ &[data-size='l']:not([data-vertical]) {
height: var(--tui-height-l);
}
+ &[data-size='m']:not([data-vertical]) {
+ height: var(--tui-height-m);
+ }
+
&:before {
.transition(~'width, left');
@@ -70,6 +135,11 @@ tui-tabs[data-vertical],
}
}
+ &[data-size='m'] [tuiTab] {
+ min-height: 2.25rem;
+ font: var(--tui-font-text-s);
+ }
+
&[data-vertical='right'] {
box-shadow: inset 1px 0 var(--tui-base-03);
@@ -89,58 +159,3 @@ tui-tabs[data-vertical],
}
}
}
-
-[tuiTab] {
- .transition(~'color, box-shadow, opacity, background');
- .clearbtn();
-
- position: relative;
- display: flex;
- flex-shrink: 0;
- height: 100%;
- box-sizing: border-box;
- justify-content: space-between;
- line-height: 1.5rem;
- align-items: center;
- white-space: nowrap;
- cursor: pointer;
- outline: none;
- color: inherit;
- margin-left: var(--tui-tab-margin, 1.5rem);
-
- &:disabled {
- opacity: var(--tui-disabled-opacity);
- pointer-events: none;
- }
-
- &._active {
- color: var(--tui-text-01);
- box-shadow: none;
- }
-
- &:focus-visible {
- outline: 2px solid var(--tui-focus);
- outline-offset: -2px;
- }
-
- tui-tabs._underline &:hover:not(._active),
- [tuiTabs]._underline &:hover:not(._active) {
- box-shadow: inset 0 -2px var(--tui-base-03);
- }
-
- tui-tabs > &:first-child,
- [tuiTabs] > &:first-child,
- tui-tabs > :not(.t-overflown) > &:first-child {
- margin-left: 0;
- }
-
- tui-tabs > [tuiTab] ~ :not(.t-overflown) > &:first-child {
- margin-left: var(--tui-tab-margin, 1.5rem);
- }
-
- @media (hover: hover) {
- &:hover {
- color: var(--tui-text-01);
- }
- }
-}