import { KbqButtonModule } from '@koobiq/components/button';

KbqButton

componentCopy link to KbqButton
@Component({ selector: '[kbq-button]' })
class KbqButton extends KbqColorDirective<KbqButtonColor> implements KbqTitleTextRef {
    kbqStyle = input<KbqButtonStyleInput | null | undefined>();
    disabled = input<boolean | undefined>();
    readonly color = input<T | null | undefined>();
    hasFocus: boolean;
    get textElement(): ElementRef<HTMLElement>;
    get parentTextElement(): ElementRef<HTMLElement>;
    haltDisabledEvents: (event: Event) => void;
    get colorClassName(): string;
    onFocus(): void;
    onBlur(): void;
    getHostElement(): HTMLElement;
    focus(): void;
    focusViaKeyboard(): void;
    projectContentChanged(): void;
    setDefaultColor(color: T): void;
}
kbqStyleinputCopy link to kbqStyleKbqButtonStyleInput | null | undefined

Visual style of the button. Setting it to a value marks that value as owned by the button, so a surrounding KbqButtonGroupRoot no longer overrides it.

Reads back as the resulting host class rather than the value that was set, because the host [class] binding is what consumes it.

disabledinputCopy link to disabledboolean | undefined

Whether the button is disabled. A surrounding KbqButtonGroupRoot can disable the button in addition to this input, but never re-enables a button disabled through it.

colorinputCopy link to colorT | null | undefined

Color of the component. A value set in code holds until the input changes, and the default color is used while both are unset or falsy.

textElementCopy link to textElementElementRef<HTMLElement>

The text box of the button, measured by kbq-title. Always rendered by the template.

parentTextElementCopy link to parentTextElementElementRef<HTMLElement>

The flex row that lays out the icons and text, used as the overflow width constraint.

colorClassNameCopy link to colorClassNamestring

current class name of color

setDefaultColor()Copy link to setDefaultColor()void

this color will be used as a default value. For example [color]="'' | false | undefined | null".

KbqButtonGroup

componentCopy link to KbqButtonGroup

Groups and styling related KbqButtons into a single visual unit.

@Component({ selector: 'kbq-button-group, [kbq-button-group]' })
class KbqButtonGroup {
    readonly orientation = input<KbqOrientation>('horizontal');
}
orientationinputCopy link to orientationKbqOrientation

Layout direction: 'horizontal' or 'vertical'. Defaults to 'horizontal'.

KbqButtonCssStyler

directiveCopy link to KbqButtonCssStyler

Applies the kbq-button/kbq-button-icon host class and the left/right icon modifier classes.

A button is treated as an icon button when its projected content consists only of KbqIcons and there are at most 2 of them. When icons are mixed with other content, only the outermost icons receive the left/right classes.

Must be used together with KbqButton (both match [kbq-button]): icon detection relies on the .kbq-button-wrapper element rendered by the component's template.

@Directive({ selector: '[kbq-button]' })
class KbqButtonCssStyler {
    readonly icons: Signal<readonly KbqIcon[]>;
    readonly nativeElement: HTMLElement;
    get isIconButton(): boolean;
    get hasNoLabel(): boolean;
    updateClassModifierForIcons(): void;
}
isIconButtonCopy link to isIconButtonboolean

Whether the button contains only icons (at most 2).

hasNoLabelCopy link to hasNoLabelboolean

Whether the projected label holds no text at all, e.g. an icon-only button.

KbqButtonDropdownTrigger

directiveCopy link to KbqButtonDropdownTrigger

This directive enhances kbq-button elements acting as dropdown triggers, visually indicating the active state with the kbq-active class, following Koobiq Design System.

The directive relies on a separate KbqDropdownTrigger directive to get dropdown's state.

@Directive({ selector: '[kbq-button][kbqDropdownTriggerFor]' })
class KbqButtonDropdownTrigger {
    dropdownTrigger: KbqDropdownTrigger;
}

KbqButtonGroupRoot

directiveCopy link to KbqButtonGroupRoot

Root directive that groups related buttons, propagating a shared style, color, and disabled state to every nested button

@Directive({ selector: '[kbqButtonGroupRoot]' })
class KbqButtonGroupRoot extends KbqColorDirective<KbqButtonColor> {
    kbqStyle = input<KbqButtonStyleInput | null | undefined>();
    disabled = input<boolean | undefined>();
    readonly color = input<T | null | undefined>();
    get colorClassName(): string;
    setDefaultColor(color: T): void;
}
kbqStyleinputCopy link to kbqStyleKbqButtonStyleInput | null | undefined

Style applied to the group and propagated to every nested button. A button that sets its own kbqStyle keeps it.

disabledinputCopy link to disabledboolean | undefined

Whether the root is disabled. Disabling the group disables every nested button; re-enabling it leaves buttons that are disabled through their own input untouched.

Stays undefined while the input is unbound so that nested buttons are not force-enabled.

colorinputCopy link to colorT | null | undefined

Color of the component. A value set in code holds until the input changes, and the default color is used while both are unset or falsy.

colorClassNameCopy link to colorClassNamestring

current class name of color

setDefaultColor()Copy link to setDefaultColor()void

this color will be used as a default value. For example [color]="'' | false | undefined | null".

KbqButtonPrefix

directiveCopy link to KbqButtonPrefix

Marks content to be projected into the prefix (leading) slot of a button.

@Directive({ selector: '[kbqButtonPrefix]' })
class KbqButtonPrefix {}

KbqButtonSuffix

directiveCopy link to KbqButtonSuffix

Marks content to be projected into the suffix (trailing) slot of a button.

@Directive({ selector: '[kbqButtonSuffix]' })
class KbqButtonSuffix {}

KbqButtonColor

typeCopy link to KbqButtonColor

Colors a button can be rendered in, as an enum member or its plain string form.

A narrower set than KbqComponentColors: the design system pairs each color with a subset of the styles (filled with contrast/contrast-fade, outline with theme-fade/contrast-fade, transparent with theme/contrast), and defines no button appearance for the status colors. A pair the design system does not define falls back to the style's default color rather than leaving the button unstyled.

type KbqButtonColor = KbqEnumValues<
    | KbqComponentColors.Theme
    | KbqComponentColors.ThemeFade
    | KbqComponentColors.Contrast
    | KbqComponentColors.ContrastFade
>;

KbqButtonStyle

typeCopy link to KbqButtonStyle

Visual style of a button, as an enum member or its plain string form.

type KbqButtonStyle = KbqEnumValues<KbqButtonStyles>;

KbqButtonStyleInput

typeCopy link to KbqButtonStyleInput

Value accepted by the kbqStyle input: one of the built-in styles, or a custom string that is applied verbatim as the kbq-button_<value> host class and themed by whoever sets it — kbq-filter-bar defines its changed-filter style that way. A custom style is not covered by kbq-button-theme() and takes the filled default color.

type KbqButtonStyleInput = KbqButtonStyle | (string & {});

KbqButtonStyles

enumCopy link to KbqButtonStyles

Visual style of a button.

enum KbqButtonStyles {
    Filled = 'filled',
    Outline = 'outline',
    Transparent = 'transparent'
}

buttonLeftIconClassName

constCopy link to buttonLeftIconClassName

Class set on a button host whose first visible child is an icon.

Public CSS hook: consumed by dropdown.scss to detect an icon-only dropdown trigger.

const buttonLeftIconClassName: string;

buttonRightIconClassName

constCopy link to buttonRightIconClassName

Class set on a button host whose last visible child is an icon.

Public CSS hook: consumed by dropdown.scss to detect an icon-only dropdown trigger.

const buttonRightIconClassName: string;
Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.