import { KbqFormFieldModule } from '@koobiq/components/form-field';Element to be placed in end of the form field. Resets form control by click.
@Component({ selector: 'kbq-cleaner', exportAs: 'kbqCleaner' })
class KbqCleaner extends KbqIconButton {
readonly ariaLabel = input<string | undefined>(undefined, {
alias: 'aria-label'
});
readonly size = input<KbqIconButtonSize>('normal');
tabindex = input<number | null | undefined>();
disabled = input<boolean | undefined>();
readonly ariaHidden = input<boolean | undefined>(undefined, {
alias: 'aria-hidden'
});
readonly iconSize = input<number | undefined>();
autoColor = input<boolean | undefined>();
readonly color = input<T | null | undefined>();
hasError: boolean;
iconName: string | undefined;
get colorClassName(): string;
getHostElement(): HTMLElement;
setDefaultColor(color: T): void;
}aria-labelstring | undefined Accessible name of the cleaner. Defaults to the localized "Clear".
localeOverridesKbqPartialLocaleData | undefined Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.
sizeKbqIconButtonSize Size of the icon button.
tabindexnumber | null | undefined Position of the button in the tab order. A disabled button is taken out of it entirely.
disabledboolean | undefined Whether the button is disabled.
aria-hiddenboolean | undefined Whether the icon is hidden from assistive technology. Left unbound, it falls back to
defaultAriaHidden, which is true for a decorative icon and false for an interactive one.
iconSizenumber | undefined Rendered size of the icon in pixels. Left unset, the size is read from the _<px> suffix of the
icon name (kbq-plus_16 → 16), which is the @koobiq/icons convention; a name without one is
rendered at whatever size the surrounding styles give it.
autoColorboolean | undefined Whether the icon follows the error state of the host it sits in (a form field, for one), painting itself red while that host reports an error.
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.
hasErrorboolean Whether the icon takes the error color whatever its color is. Set by a host that tints the icons
it holds, such as KbqEmptyState.
iconNamestring | undefined Name of an icon within a @koobiq/icons. Accepts "namespace:name" syntax.
colorClassNamestring current class name of color
setDefaultColor()void this color will be used as a default value. For example [color]="'' | false | undefined | null".
Error text to be shown below the form field control. It keeps the error color under a disabled control too.
@Component({ selector: 'kbq-error', exportAs: 'kbqError' })
class KbqError extends KbqHint {
readonly id = input<string>(`kbq-hint-${nextUniqueId++}`);
readonly fillTextOff = input<boolean>(false);
readonly compact = input<boolean>(false);
readonly color = input<T | null | undefined>();
get colorClassName(): string;
setDefaultColor(color: T): void;
}idstring Unique ID for the hint. Referenced by the aria-describedby of the form field control.
fillTextOffboolean Disables color for the hint text.
compactboolean Makes the hint size smaller.
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.
colorClassNamestring current class name of color
setDefaultColor()void this color will be used as a default value. For example [color]="'' | false | undefined | null".
A group of form-fields and related controls.
Container component emulating the native fieldset element.
@Component({ selector: 'kbq-fieldset', exportAs: 'kbqFieldset' })
class KbqFieldset {}Container for form controls that applies styling and behavior.
@Component({ selector: 'kbq-form-field', exportAs: 'kbqFormField' })
class KbqFormField extends KbqColorDirective {
readonly noBorders = input<boolean | undefined>(
this.defaultOptions?.noBorders
);
readonly inOverlay = model<boolean | undefined>(
this.defaultOptions?.inOverlay
);
readonly horizontal = input<boolean | undefined>(
this.defaultOptions?.horizontal
);
readonly labelClass = input<string | string[] | Set<string> | undefined>(
this.defaultOptions?.labelClass
);
readonly contentClass = input<string | string[] | Set<string> | undefined>(
this.defaultOptions?.contentClass
);
readonly showRequiredMarker = input<boolean>(
!!this.defaultOptions?.showRequiredMarker
);
readonly color = input<T | null | undefined>();
get invalid(): boolean;
readonly labelId: Signal<string | null>;
readonly isNativeLabelSupported: Signal<boolean>;
get disabled(): boolean;
readonly readonly: Signal<boolean>;
get autofilled(): boolean;
get colorClassName(): string;
focus(options?: FocusOptions): void;
getConnectedOverlayOrigin(): ElementRef;
setDefaultColor(color: T): void;
}noBordersboolean | undefined Disables form field borders and shadows.
inOverlayboolean | undefined Use when KbqFormField is in an overlay container.
horizontalboolean | undefined Whether the form field is displayed horizontally.
labelClassstring | string[] | Set<string> | undefined Additional CSS classes applied to the label element.
contentClassstring | string[] | Set<string> | undefined Additional CSS classes applied to the content wrapper element.
showRequiredMarkerboolean Whether the label of a required control ends with the * marker. A control is required by its required
state or by Validators.required on its form control.
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.
invalidboolean Whether the form field is invalid.
labelIdSignal<string | null> Id of the rendered label, or null when the form field has no label.
for only associates a label with a native form control, so a control that is a custom element
(kbq-select, for one) has to point back at the label through aria-labelledby instead.
isNativeLabelSupportedSignal<boolean> Whether the control is a native labelable element, so that a <label> can associate with it.
A custom control (kbq-select, for one) reports isNativeLabelSupported: false; the caption is then rendered
as a <span> instead of a <label>, because a label that neither has a for matching a labelable
element nor wraps one is invalid, and the control is named through aria-labelledby instead.
disabledboolean Whether the form field is disabled.
readonlySignal<boolean> Whether the form field control is read-only.
autofilledboolean Whether the form field control's value was filled in by the browser. Controls that cannot be
autofilled do not implement autofilled, and report false here.
Reflected as kbq-form-field_autofilled for application code to key on. The autofill styling
does not use it: CSS matches :autofill directly, in the same style pass the browser fills
the field, where this arrives a frame or two later. Keeping the paint on one source also means
a class left behind by a detached or re-attached control cannot tint a field the browser no
longer considers autofilled.
colorClassNamestring current class name of color
focus()void Focuses the control.
getConnectedOverlayOrigin()ElementRef Gets an ElementRef for the element that a overlay attached to the form-field should be positioned relative to.
setDefaultColor()void this color will be used as a default value. For example [color]="'' | false | undefined | null".
Hint text to be shown below the form field control.
@Component({ selector: 'kbq-hint', exportAs: 'kbqHint' })
class KbqHint extends KbqColorDirective {
readonly id = input<string>(`kbq-hint-${nextUniqueId++}`);
readonly fillTextOff = input<boolean>(false);
readonly compact = input<boolean>(false);
readonly color = input<T | null | undefined>();
get colorClassName(): string;
setDefaultColor(color: T): void;
}idstring Unique ID for the hint. Referenced by the aria-describedby of the form field control.
fillTextOffboolean Disables color for the hint text.
compactboolean Makes the hint size smaller.
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.
colorClassNamestring current class name of color
setDefaultColor()void this color will be used as a default value. For example [color]="'' | false | undefined | null".
Component which changes password visibility.
@Component({ selector: 'kbq-password-toggle', exportAs: 'kbqPasswordToggle' })
class KbqPasswordToggle extends KbqTooltipTrigger {
readonly tabindex = input<number>(0);
readonly kbqTooltipHidden = input<string | TemplateRef<any>>();
readonly forDisabledComponent = input<Record<'disabledSignal', WritableSignal<boolean>>>();
readonly ignoreTooltipPointerEvents = input<boolean>(false);
readonly singleInstance = input<boolean>(
inject(KBQ_TOOLTIP_SINGLE_INSTANCE_DEFAULT),
{ alias: 'kbqTooltipSingleInstance' }
);
hideWithTimeout = input<boolean | undefined>();
content: string | TemplateRef<any>;
tooltipVisible: boolean;
tooltipPlacement: KbqPopUpPlacementValues;
relativeToPointer: boolean;
relativeToCaret: boolean;
relativeToCaretVertical: KbqCaretVerticalAnchor;
tooltipPlacementPriority: string | string[] | null;
disabled: boolean;
enterDelay: number;
leaveDelay: number;
trigger: string;
customClass: string;
context: unknown;
color: KbqComponentColors | string;
arrow: boolean;
arrowCentered: boolean;
offset: number | null;
readonly placementChange: EventEmitter<KbqPopUpPlacementValues>;
readonly visibleChange: EventEmitter<boolean>;
modifier: KbqEnumValues<TooltipModifier>;
header: string | TemplateRef<unknown>;
isOpen: boolean;
get isAttached(): boolean;
get openedChange(): Observable<boolean>;
show(delay?: number): void;
hide(delay?: number): void;
showForMouseEvent(event: MouseEvent): void;
showForElement(element: HTMLElement): void;
updateOrigin(origin: KbqOverlayOrigin | null): void;
}kbqTooltipHiddenstring | TemplateRef<any> Tooltip shown while the password is hidden.
localeOverridesKbqPartialLocaleData | undefined Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.
forDisabledComponentRecord<'disabledSignal', WritableSignal<boolean>> Input for controlling the disabled state of a component.
The input expects a component containing disabledSignal property, which is
a writable signal emitting boolean values.
ignoreTooltipPointerEventsboolean Determines whether pointer events should be ignored on tooltips.
When set to true, the tooltip pane does not receive pointer events, so clicks and hovers pass through
to whatever is underneath it. Defaults to false, which keeps the tooltip hoverable: a user who needs
more time to read it — or who reads at high magnification, where the pointer often ends up over the
tooltip itself — can move the pointer onto it without it disappearing (WCAG 1.4.13 "Content on Hover").
Set it to true for tooltips that float over other click targets, such as the overflow hints of a
scrolling option list.
kbqTooltipSingleInstanceboolean Whether the tooltip takes part in the "only one tooltip is visible at a time" group: showing it hides the previously visible tooltip, and it is hidden when another tooltip is shown.
Defaults to true; the default can be changed application-wide with the
KBQ_TOOLTIP_SINGLE_INSTANCE_DEFAULT token.
Tooltips without an interactive kbqTrigger (manual, none, …) never take part in the group,
regardless of this input — they are shown imperatively and are expected to stay pinned.
hideWithTimeoutboolean | undefined Changes hiding behavior. By default, tooltip is hidden on mouseleave from trigger. Setting hideWithTimeout to true will delay tooltip hiding and will not hide when the mouse moves from trigger to tooltip.
contentstring | TemplateRef<any> Tooltip shown while the password is visible. Reading it resolves to the tooltip matching the current visibility, so that the base trigger renders the right one.
tooltipVisibleboolean Input (kbqVisible) that programmatically shows or hides the tooltip; reflects the current visible state.
tooltipPlacementKbqPopUpPlacementValues Input (kbqPlacement) that sets the tooltip placement relative to its trigger; reflects the current placement.
relativeToPointerboolean Positions the tooltip relative to the mouse cursor. Only available for top and bottom kbqPlacement. Does not work with kbqPlacementPriority.
relativeToCaretboolean Positions the tooltip relative to the text caret of the field it is attached to, following it while the user types, moves the caret and scrolls the field. Anchors to the selection whenever there is one.
Every placement is available, unlike with kbqRelativeToPointer: the caret is anchored as a rectangle,
so the usual fallback placements keep the tooltip on screen. Wins when both inputs are enabled.
The field is the host element itself when it is editable, otherwise the first editable it wraps.
relativeToCaretVerticalKbqCaretVerticalAnchor What the tooltip is vertically anchored to while kbqRelativeToCaret is enabled.
tooltipPlacementPrioritystring | string[] | null Input (kbqPlacementPriority) that sets the ordered fallback placements; reflects the current placementPriority.
disabledboolean Input (kbqTooltipDisabled) controlling whether the tooltip is disabled; setting it to true hides it.
undefined leaves the decision to the trigger, like an unset input.
Reads back the effective state, which for triggers that derive one of their own (see
derivedDisabledWins) is not necessarily the value that was written.
enterDelaynumber Input (kbqEnterDelay) — delay in milliseconds before the tooltip is shown. Defaults to 400.
leaveDelaynumber Input (kbqLeaveDelay) — delay in milliseconds before the tooltip is hidden. Defaults to 0.
triggerstring Input (kbqTrigger) with the comma-separated trigger events. An empty value resets to hover + focus and rebinds listeners.
customClassstring Input (kbqTooltipClass) with an extra CSS class applied to the tooltip; updating it refreshes the class map.
contextunknown Input (kbqTooltipContext) with the context object passed to a template tooltip; updating it refreshes the open tooltip.
colorKbqComponentColors | string Input (kbqTooltipColor) with the tooltip color theme. Defaults to KbqComponentColors.Contrast.
arrowboolean Input (kbqTooltipArrow) — whether to render the tooltip's arrow/pointer. Defaults to false.
arrowCenteredboolean Input (kbqTooltipArrowCentered) — centers the arrow on the trigger while preserving the panel placement.
Requires a visible arrow. Defaults to false.
offsetnumber | null Input (kbqTooltipOffset) — distance in pixels between the tooltip and its trigger. null keeps
the gap of the stylesheet. Defaults to the offset of KBQ_TOOLTIP_DEFAULT_OPTIONS, when a
provider in scope set one. Inside a provider scope such as the navbar's, null/undefined restores
that inherited default.
placementChangeEventEmitter<KbqPopUpPlacementValues> Output (kbqPlacementChange) that emits the new placement whenever the tooltip repositions.
visibleChangeEventEmitter<boolean> Output (kbqVisibleChange) that emits when the tooltip's visibility changes.
modifierKbqEnumValues<TooltipModifier> Visual variant of the tooltip. Accepts 'default' | 'warning' | 'extended'.
Replaces the removed KbqWarningTooltipTrigger and KbqExtendedTooltipTrigger
subclasses — to render a warning tooltip use kbqTooltipModifier="warning",
and kbqTooltipModifier="extended" for the extended variant (combine with kbqTooltipHeader).
headerstring | TemplateRef<unknown> Header text or template, rendered above the tooltip content. Only meaningful with
kbqTooltipModifier="extended". Replaces the removed KbqExtendedTooltipTrigger.header.
isOpenboolean Whether the pop-up overlay is currently open.
isAttachedboolean Whether the pop-up overlay is currently attached.
Unlike isOpen, which follows the visibility of the pop-up component and therefore lags a task behind
show()/hide(), this flips synchronously — it is the window during which the overlay (and its
backdrop) is present in the DOM. Part of the KbqSiblingPopup contract.
openedChangeObservable<boolean> Emits true when the pop-up opens and false when it closes. Part of the KbqSiblingPopup contract.
show()void Shows the tooltip after delay ms. Suppresses showing while a pop-up on the same element holds the
anchor or on a focus trigger that did not originate from the keyboard, and applies cursor-relative
positioning when relativeToPointer is enabled.
hide()void Hides the tooltip after delay ms and, when the user has genuinely left the host, un-mutes a tooltip
that a pop-up on the same element had muted.
mouseleave and blur are the release signals because the base class binds hide to both regardless
of whether the tooltip is currently visible. A pop-up that is still attached does not count: its
backdrop steals the hover from the trigger while the pointer stands still, and that mouseleave must
not be mistaken for the user leaving.
showForMouseEvent()void Shows the tooltip next to the cursor position of the given mouse event, anchoring it to the event's
currentTarget instead of the directive's own host element.
Use it when the trigger cannot be declared in the template — for instance for a tooltip shared by the cells of a virtualized table. The directive still has to be created in an injection context.
showForElement()void Shows the tooltip anchored to the given element instead of the directive's own host element.
Use it when the trigger cannot be declared in the template. The directive still has to be created in an injection context:
const tooltip = runInInjectionContext(injector, () => new KbqTooltipTrigger());
tooltip.showForElement(element);Does nothing while the tooltip is disabled or has no content — there is no overlay to anchor then.
updateOrigin()void Positions the pop-up against origin — an element, or a rectangle in viewport coordinates such as the one
kbqCreateCaretOrigin keeps on the caret — instead of the host element; null restores the host
element. An open pop-up moves to the new origin at once.
This moves the position origin only. setExternalNativeElement moves the host itself, and with it
the trigger's event listeners, its focus target and the scroll containers the pop-up follows.
Password hint to be shown below the password form field control.
@Component({
selector: 'kbq-reactive-password-hint',
exportAs: 'kbqReactivePasswordHint'
})
class KbqReactivePasswordHint extends KbqHint {
readonly hasError = input<boolean>(false);
readonly fillTextOff = input<boolean>(true);
readonly id = input<string>(`kbq-hint-${nextUniqueId++}`);
readonly compact = input<boolean>(false);
readonly color = input<T | null | undefined>();
get colorClassName(): string;
setDefaultColor(color: T): void;
}hasErrorboolean Whether the form field control has an error.
fillTextOffboolean Disables color for the hint text.
idstring Unique ID for the hint. Referenced by the aria-describedby of the form field control.
compactboolean Makes the hint size smaller.
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.
colorClassNamestring current class name of color
setDefaultColor()void this color will be used as a default value. For example [color]="'' | false | undefined | null".
Component which allow to increment or decrement number value.
@Component({ selector: 'kbq-stepper', exportAs: 'kbqStepper' })
class KbqStepper {
readonly stepUp = output<void>();
readonly stepDown = output<void>();
}stepUpvoid Emitted when the stepper is incremented.
stepDownvoid Emitted when the stepper is decremented.
Directive for marking elements as items inside KbqFieldset
@Directive({ selector: '[kbqFieldsetItem]', exportAs: 'kbqFieldsetItem' })
class KbqFieldsetItem {}Label for the form field.
@Directive({ selector: 'kbq-label', exportAs: 'kbqLabel' })
class KbqLabel {}Directive for marking an element as legend of KbqFieldset
@Directive({ selector: '[kbqLegend]', exportAs: 'kbqLegend' })
class KbqLegend {
readonly id = input<string>(`kbq-legend-${nextLegendUniqueId++}`);
}idstring Unique ID for the legend, referenced by the aria-labelledby of the fieldset.
Element to be placed in front of the form field.
@Directive({ selector: '[kbqPrefix]', exportAs: 'kbqPrefix' })
class KbqPrefix {}Element to be placed at the end of the form field.
@Directive({ selector: '[kbqSuffix]', exportAs: 'kbqSuffix' })
class KbqSuffix {}An interface which allows a control to work inside of a KbqFormField.
Every state member is a signal: the form field derives its own state from them and runs OnPush, so a
change of the control reaches it without any notification of the control's own.
abstract class KbqFormFieldControl<T> {
readonly value: Signal<T | null>;
readonly id: Signal<string>;
readonly placeholder: Signal<string | null | undefined>;
readonly ngControl: NgControl | null;
readonly focused: Signal<boolean>;
readonly empty: Signal<boolean>;
readonly required: Signal<boolean>;
readonly disabled: Signal<boolean>;
readonly errorState: Signal<boolean>;
readonly readonly?: Signal<boolean>;
readonly autofilled?: Signal<boolean>;
readonly controlType?: string;
readonly isNativeLabelSupported?: boolean;
setDescribedByIds?: (ids: string[]) => void;
open?: () => void;
abstract onContainerClick(event: MouseEvent): void;
abstract focus(options?: FocusOptions): void;
}valueSignal<T | null> The value of the control.
idSignal<string> The element ID for this control.
placeholderSignal<string | null | undefined> The placeholder for this control.
ngControlNgControl | null Gets the NgControl for this control.
focusedSignal<boolean> Whether the control is focused.
emptySignal<boolean> Whether the control is empty.
requiredSignal<boolean> Whether the control is required.
disabledSignal<boolean> Whether the control is disabled.
errorStateSignal<boolean> Whether the control is in an error state.
readonlySignal<boolean> Whether the control is read-only: it can be focused and its value selected and copied, but not changed.
Implement it only on a control that has a read-only state. KbqFormField then hides the cleaner and adds
the kbq-form-field_readonly class.
autofilledSignal<boolean> Whether the control's value was filled in by the browser.
Implement it only where autofill is reachable: on a control that is itself a text input or a
textarea, or — like KbqTagList — on a wrapper that forwards the state of the input it hosts.
Leave it out on controls the browser never fills.
controlTypestring An optional name for the control type that can be used to distinguish kbq-form-field elements
based on their control type. The form field will add a class,
kbq-form-field-type-{{controlType}} to its root element.
isNativeLabelSupportedboolean Whether the control is a native labelable element, so that the <label for> a wrapping
kbq-form-field renders associates with it.
Defaults to true. A control rendered as a custom element (kbq-select, for one) sets it to
false: a <label> with neither a for matching a labelable element nor a nested one is
invalid, so the form field renders the caption as a <span> instead and the control is named
through aria-labelledby.
setDescribedByIds(ids: string[]) => void Sets the ids of the elements (hints, errors) that describe the control.
Implement it only when aria-describedby has to be placed on an element other than the one
the control is declared on: KbqFormField writes the attribute on the control's host element
by default.
open() => void Opens control's overlay.
onContainerClick()void Handles a click on the control's container.
focus()void Focuses the control.
Default options for the kbq-form-field that can be configured using the KBQ_FORM_FIELD_DEFAULT_OPTIONS
injection token.
type KbqFormFieldDefaultOptions = Partial<{
noBorders: boolean;
inOverlay: boolean;
horizontal: boolean;
labelClass: string | string[] | Set<string>;
contentClass: string | string[] | Set<string>;
showRequiredMarker: boolean;
}>;noBordersboolean Disables form field borders and shadows.
inOverlayboolean Use when KbqFormField is in an overlay container.
horizontalboolean Whether the form field is displayed horizontally.
labelClassstring | string[] | Set<string> Additional CSS classes applied to the label element.
contentClassstring | string[] | Set<string> Additional CSS classes applied to the content wrapper element.
showRequiredMarkerboolean Whether the label of a required control ends with the * marker.
Utility provider for KBQ_FORM_FIELD_DEFAULT_OPTIONS.
const kbqFormFieldDefaultOptionsProvider: (
options: KbqFormFieldDefaultOptions
) => Provider;