import { KbqTagsModule } from '@koobiq/components/tags';

KbqTag

componentСкопировать ссылку на KbqTag
@Component({
selector: 'kbq-tag, [kbq-tag], kbq-basic-tag, [kbq-basic-tag]',
exportAs: 'kbqTag'
})
class KbqTag extends KbqColorDirective implements IFocusableOption, KbqTitleTextRef {
readonly editable = input<boolean | undefined>();
readonly preventEditSubmit = input<boolean>(false);
readonly selected = input(false);
value = input<NonNullable<unknown> | null | undefined>();
readonly selectable = input(false);
readonly removable = input(true);
tabindex = input<number | null | undefined>();
disabled = input<boolean | undefined>();
readonly color = input<T | null | undefined>();
readonly editChange = output<KbqTagEditChange>();
readonly selectionChange = output<KbqTagSelectionChange>();
readonly destroyed = output<KbqTagEvent>();
readonly removed = output<KbqTagEvent>();
changeDetectorRef: ChangeDetectorRef;
readonly contentChildren: Signal<readonly KbqIcon[]>;
readonly avatar: Signal<KbqTagAvatar | undefined>;
readonly trailingIcon: Signal<KbqTagTrailingIcon | undefined>;
readonly removeIcon: Signal<any>;
get canRemove(): boolean;
get colorClassName(): string;
select(): void;
deselect(): void;
toggleSelected(isUserInput?: boolean): boolean;
focus(): void;
remove(): void;
setDefaultColor(color: T): void;
}
editableinputСкопировать ссылку на editableboolean | undefined

Whether the tag is editable.

preventEditSubmitinputСкопировать ссылку на preventEditSubmitboolean

Whether the tag edits can't be submitted.

selectedinputСкопировать ссылку на selectedSignal<boolean>

Whether the tag is selected.

valueinputСкопировать ссылку на valueNonNullable<unknown> | null | undefined

The value of the tag. Defaults to the content inside <kbq-tag> tags.

selectableinputСкопировать ссылку на selectableSignal<boolean>

Whether the tag is selectable.

removableinputСкопировать ссылку на removableSignal<boolean>

Determines whether the tag is removable.

tabindexinputСкопировать ссылку на tabindexnumber | null | undefined

Tab order of the tag.

disabledinputСкопировать ссылку на disabledboolean | undefined

Whether the tag is disabled.

localeOverridesinputСкопировать ссылку на localeOverridesKbqPartialLocaleData | undefined

Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.

colorinputСкопировать ссылку на 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.

editChangeoutputСкопировать ссылку на editChangeKbqTagEditChange

Emits event when the tag is edited.

selectionChangeoutputСкопировать ссылку на selectionChangeKbqTagSelectionChange

Emitted when the tag is selected or deselected.

destroyedoutputСкопировать ссылку на destroyedKbqTagEvent

Emitted when the tag is destroyed and leaving the DOM.

removedoutputСкопировать ссылку на removedKbqTagEvent

Emitted when a tag is to be removed. Fires on programmatic and UI removal (click or keyboard).

avatarСкопировать ссылку на avatarSignal<KbqTagAvatar | undefined>

The tag avatar

trailingIconСкопировать ссылку на trailingIconSignal<KbqTagTrailingIcon | undefined>

The tag's trailing icon.

removeIconСкопировать ссылку на removeIconSignal<any>

The tag's remove toggler.

canRemoveСкопировать ссылку на canRemoveboolean

Whether the user may remove this tag through the controls the tag itself offers — the remove control and the Delete key. A disabled tag offers neither.

This is the affordance, not the channel: remove() stays open so the list can still clear a disabled tag when clearPredicate asks for it.

colorClassNameСкопировать ссылку на colorClassNamestring

current class name of color

toggleSelected()Скопировать ссылку на toggleSelected()boolean

Toggles the current selected state of the tag.

remove()Скопировать ссылку на remove()void

Allows for programmatic removal of the tag. Called by the KbqTagList when the DELETE or BACKSPACE keys are pressed.

Informs any listeners of the removal request. Does not remove the tag from the DOM.

setDefaultColor()Скопировать ссылку на setDefaultColor()void

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

KbqTagList

componentСкопировать ссылку на KbqTagList
@Component({ selector: 'kbq-tag-list', exportAs: 'kbqTagList' })
class KbqTagList implements KbqFormFieldControl<any>, ControlValueAccessor, CanUpdateErrorState {
draggable = input<boolean | undefined>();
readonly selectable = input<boolean>(true);
readonly editable = input<boolean>(false);
readonly clearPredicate = input<(tag: KbqTag) => boolean>(
(tag) => !tag.disabled
);
readonly removable = input<boolean>(true);
readonly errorStateMatcher = input<ErrorStateMatcher>();
readonly dropped = output<KbqTagListDroppedEvent>();
readonly change = output<KbqTagListChange>();
defaultErrorStateMatcher: ErrorStateMatcher;
parentForm: NgForm | null;
parentFormGroup: FormGroupDirective | null;
ngControl: NgControl;
readonly focused: Signal<boolean>;
notifyPendingTagChange(): void;
focus(): void;
blur(): void;
markAsTouched(): void;
}
draggableinputСкопировать ссылку на draggableboolean | undefined

Whether the tags in the list can be reordered by dragging.

selectableinputСкопировать ссылку на selectableboolean

Whether or not this tag list is selectable. When a tag list is not selectable, the selected states for all the tags inside the tag list are always ignored.

editableinputСкопировать ссылку на editableboolean

Whether the tags in the list are editable.

clearPredicateinputСкопировать ссылку на clearPredicate(tag: KbqTag) => boolean

Decides which tags the projected KbqCleaner removes: return true to clear the tag, false to keep it. Disabled tags are kept by default. Bind a stable reference — a new function on every change detection re-runs the predicate over every tag.

A tag the list does not allow to be removed is never offered, whatever the predicate answers.

removableinputСкопировать ссылку на removableboolean

Whether the tags in the list are removable.

errorStateMatcherinputСкопировать ссылку на errorStateMatcherErrorStateMatcher

An object used to control when error messages are shown.

droppedoutputСкопировать ссылку на droppedKbqTagListDroppedEvent

Emits when the user drops tag inside tag list container.

changeoutputСкопировать ссылку на changeKbqTagListChange

Event emitted when the selected tag list value has been changed by the user.

focusedСкопировать ссылку на focusedSignal<boolean>

Whether any tags or the kbqTagInput inside of this tag-list has focus.

notifyPendingTagChange()Скопировать ссылку на notifyPendingTagChange()void

Notifies that the next tags.changes emission is UI-initiated.

focus()Скопировать ссылку на focus()void

Focuses the tag list. If there is a tag input, focuses that instead.

blur()Скопировать ссылку на blur()void

When blurred, mark the field as touched when focus moved outside the tag list.

markAsTouched()Скопировать ссылку на markAsTouched()void

Mark the field as touched

KbqTagEditInput

directiveСкопировать ссылку на KbqTagEditInput

Directive to add input behavior for the editable tag.

@Directive({ selector: '[kbqTagEditInput]', exportAs: 'kbqTagEditInput' })
class KbqTagEditInput {}

KbqTagEditSubmit

directiveСкопировать ссылку на KbqTagEditSubmit

Directive to add submit behavior for the editable tag.

@Directive({ selector: '[kbqTagEditSubmit]', exportAs: 'kbqTagEditSubmit' })
class KbqTagEditSubmit {}

KbqTagInput

directiveСкопировать ссылку на KbqTagInput

Directive that adds tag-specific behaviors to an input element inside <kbq-form-field>. May be placed inside or outside of an <kbq-tag-list>.

@Directive({
selector: 'input[kbqTagInputFor]',
exportAs: 'kbqTagInput, kbqTagInputFor'
})
class KbqTagInput implements KbqTagTextControl {
readonly separatorKeyCodes = input<number[]>(
this.defaultOptions.separatorKeyCodes,
{ alias: 'kbqTagInputSeparatorKeyCodes' }
);
readonly distinct = input<boolean>(false);
readonly placeholder = input<string>('');
readonly id = input<string>(
inject(_IdGenerator).getId('kbq-tag-list-input-')
);
readonly tagList = input<KbqTagList | undefined>(undefined, {
alias: 'kbqTagInputFor'
});
readonly addOnBlur = input<boolean>(true, {
alias: 'kbqTagInputAddOnBlur'
});
readonly addOnPaste = input<boolean>(
this.defaultOptions.addOnPaste ?? true,
{ alias: 'kbqTagInputAddOnPaste' }
);
disabled = input<boolean | undefined>();
readonly tagEnd = output<KbqTagInputEvent>({
alias: 'kbqTagInputTokenEnd'
});
readonly autofilled: Signal<boolean>;
readonly empty: Signal<boolean>;
focus(): void;
}
kbqTagInputSeparatorKeyCodesinputСкопировать ссылку на kbqTagInputSeparatorKeyCodesnumber[]

The list of key codes that will trigger a tagEnd event.

Defaults to [ENTER].

distinctinputСкопировать ссылку на distinctboolean

A value indicating whether allow/prevent tags duplication

placeholderinputСкопировать ссылку на placeholderstring

The input's placeholder text.

idinputСкопировать ссылку на idstring

Unique id for the input.

kbqTagInputForinputСкопировать ссылку на kbqTagInputForKbqTagList | undefined

Register input for tag list.

kbqTagInputAddOnBlurinputСкопировать ссылку на kbqTagInputAddOnBlurboolean

Whether or not the tagEnd event will be emitted when the input is blurred.

kbqTagInputAddOnPasteinputСкопировать ссылку на kbqTagInputAddOnPasteboolean

Whether the tagEnd event will be emitted when the text pasted. Defaults to addOnPaste of KBQ_TAGS_DEFAULT_OPTIONS, or true.

disabledinputСкопировать ссылку на disabledboolean | undefined

Whether the input is disabled.

kbqTagInputTokenEndoutputСкопировать ссылку на kbqTagInputTokenEndKbqTagInputEvent

Emitted when a tag is to be added.

autofilledСкопировать ссылку на autofilledSignal<boolean>

Whether the control's value was filled in by the browser.

emptyСкопировать ссылку на emptySignal<boolean>

Whether the input is empty.

KbqTagPrefix

directiveСкопировать ссылку на KbqTagPrefix

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

@Directive({ selector: '[kbqTagPrefix]' })
class KbqTagPrefix {}

KbqTagRemove

directiveСкопировать ссылку на KbqTagRemove

Example:

<kbq-tag> <kbq-icon kbqTagRemove>cancel</kbq-icon> </kbq-tag>

You may use a custom icon, but you may need to override the kbq-tag-remove positioning styles to properly center the icon within the tag.

@Directive({ selector: '[kbqTagRemove]' })
class KbqTagRemove {
readonly ariaLabel = input<string | undefined>(undefined, {
alias: 'aria-label'
});
}
aria-labelinputСкопировать ссылку на aria-labelstring | undefined

Accessible name of the button. Defaults to the localized "Remove".

KbqTagSuffix

directiveСкопировать ссылку на KbqTagSuffix

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

@Directive({ selector: '[kbqTagSuffix]' })
class KbqTagSuffix {}

KbqTagEditChange

classСкопировать ссылку на KbqTagEditChange

Event object emitted by KbqTag when the tag is edited.

class KbqTagEditChange {
readonly tag: KbqTag;
readonly type: "start" | "cancel" | "submit";
readonly reason: string;
constructor(
tag: KbqTag,
type: "start" | "cancel" | "submit",
reason: string
);
}

KbqTagListChange

classСкопировать ссылку на KbqTagListChange

Change event object that is emitted when the tag list value has changed.

class KbqTagListChange {
source: KbqTagList;
value: any;
constructor(source: KbqTagList, value: any);
}

KbqTagSelectionChange

classСкопировать ссылку на KbqTagSelectionChange

Event object emitted by KbqTag when selected or deselected.

class KbqTagSelectionChange {
source: KbqTag;
selected: boolean;
isUserInput: boolean;
constructor(
source: KbqTag,
selected: boolean,
isUserInput?: boolean
);
}

KbqTagEvent

typeСкопировать ссылку на KbqTagEvent

Event object emitted by KbqTag.

type KbqTagEvent = {
tag: KbqTag;
};

KbqTagFocusEvent

typeСкопировать ссылку на KbqTagFocusEvent

Event object emitted when the KbqTag is focused.

type KbqTagFocusEvent = KbqTagEvent & {
origin: FocusOrigin;
};

KbqTagInputEvent

interfaceСкопировать ссылку на KbqTagInputEvent

Represents an input event on a kbqTagInput.

interface KbqTagInputEvent {
input: HTMLInputElement;
value: string;
}
inputСкопировать ссылку на inputHTMLInputElement

The native <input> element that the event is being fired for.

valueСкопировать ссылку на valuestring

The value of the input.

KbqTagListDroppedEvent

typeСкопировать ссылку на KbqTagListDroppedEvent
type KbqTagListDroppedEvent = Pick<CdkDragDrop<unknown>, 'event' | 'previousIndex' | 'currentIndex'> & {
tag: KbqTag;
};

KbqTagsDefaultOptions

interfaceСкопировать ссылку на KbqTagsDefaultOptions

Default options for the tags module that can be overridden.

interface KbqTagsDefaultOptions {
separatorKeyCodes: number[];
separators?: KbqTagSeparator[];
addOnPaste?: boolean;
}
separatorKeyCodesСкопировать ссылку на separatorKeyCodesnumber[]

The list of key codes that will trigger a tagEnd event.

separatorsoptionalСкопировать ссылку на separatorsKbqTagSeparator[]

Custom separator definitions to use instead of the built-in defaults.

addOnPasteoptionalСкопировать ссылку на addOnPasteboolean

Whether the tagEnd event will be emitted when text is pasted.

KbqTagSeparator

interfaceСкопировать ссылку на KbqTagSeparator

Defines a character or pattern that ends a tag, and the contexts in which it applies.

interface KbqTagSeparator {
symbol: RegExp;
key?: string;
keyCode?: number;
appliesTo?: KbqTagSeparatorContext[];
}
symbolСкопировать ссылку на symbolRegExp

Regular expression used to match/split this separator in text.

keyoptionalСкопировать ссылку на keystring

KeyboardEvent.key that triggers this separator while typing. Omit for separators with no single-keystroke equivalent (e.g. a run of whitespace) — those are implicitly paste-only, since they can never match a keydown.

keyCodeoptionalСкопировать ссылку на keyCodenumber

Numeric key code gating whether this separator is enabled, set via kbqTagInputSeparatorKeyCodes. Omit together with key for separators that should always be active regardless of that input.

appliesTooptionalСкопировать ссылку на appliesToKbqTagSeparatorContext[]

Contexts this separator applies to. Defaults to ['input', 'paste'].

KbqTagSeparatorContext

typeСкопировать ссылку на KbqTagSeparatorContext

Contexts a KbqTagSeparator can be active in.

type KbqTagSeparatorContext = 'input' | 'paste';

KBQ_TAGS_DEFAULT_OPTIONS

constСкопировать ссылку на KBQ_TAGS_DEFAULT_OPTIONS

Injection token to be used to override the default options.

const KBQ_TAGS_DEFAULT_OPTIONS: InjectionToken<KbqTagsDefaultOptions>;

kbqTagsDefaultOptionsProvider

constСкопировать ссылку на kbqTagsDefaultOptionsProvider

Utility provider for KBQ_TAGS_DEFAULT_OPTIONS.

const kbqTagsDefaultOptionsProvider: (
options: Partial<KbqTagsDefaultOptions>
) => Provider;
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.