Use KTUI with TypeScript using supported public entrypoints and strict typing.
KTUI is written in TypeScript and ships declarations for all public entrypoints. Prefer selective imports to keep initialization explicit and predictable.
@keenthemes/ktui/components/<name>: best for single-component usage.@keenthemes/ktui/core: side-effect-free multi-component imports.@keenthemes/ktui/init-all: explicit full-library initialization mode.@keenthemes/ktui (root): legacy-compatible behavior.Do not import from private paths such as src or lib/esm.
import {
KTTogglePassword,
type KTTogglePasswordConfigInterface,
} from '@keenthemes/ktui/components/toggle-password';
const options: KTTogglePasswordConfigInterface = {};
KTTogglePassword.init();import {
KTTooltip,
type KTTooltipConfigInterface,
type KTTooltipInterface,
} from '@keenthemes/ktui/core';
const tooltipEl = document.querySelector<HTMLElement>('#my_tooltip');
if (!tooltipEl) return;
const options: KTTooltipConfigInterface = {
placement: 'bottom-start',
};
const tooltip: KTTooltipInterface = new KTTooltip(tooltipEl, options);
tooltip.show();
tooltip.hide();
tooltip.toggle();Use ESM imports so bundlers can tree-shake effectively.
import { KTRating } from '@keenthemes/ktui/components/rating';
import { KTRating as KTRatingCore } from '@keenthemes/ktui/core';
import { initAllComponents } from '@keenthemes/ktui/init-all';core if a module needs multiple KTUI components but still wants explicit control.init-all only when broad initialization is intended.KTUI targets strict TypeScript usage and recommends the same for consumers.
tsconfig ("strict": true).any in application code that interacts with KTUI APIs.{
"compilerOptions": {
"strict": true
}
}components/<name> or core where possible.@keenthemes/ktui root import only when legacy auto-init behavior is required.typeof value === 'object' && value !== null before property access.