Constants, enums and types
Three small modules carry the values and the vocabulary the rest of the library is written in. All three are in the root barrel, so a plugin reaches them the same way an application does.
import { EMPTY_ARRAY, OPERATIONS_NAME } from "@onlyoffice/apps-ui-kit/constants";
import { DeviceType, RoomsType } from "@onlyoffice/apps-ui-kit/enums";
import type { TFile, TFolder, Nullable } from "@onlyoffice/apps-ui-kit/types";
Constants
Frozen empties
EMPTY_ARRAY, EMPTY_OBJECT and FUNCTION_EMPTY are shared, frozen singletons. Use them
instead of a fresh [], {} or () => {} in a default prop or a selector return: a new
literal is a new reference on every render, and that alone re-renders every memoized child
downstream.
import { EMPTY_ARRAY } from "@onlyoffice/apps-ui-kit/constants";
const items = data?.items ?? EMPTY_ARRAY;
File formats and validation
Uploads
DEFAULT_CHUNK_UPLOAD_SIZE (5 MB), DEFAULT_MAX_UPLOAD_THREAD_COUNT (3) and
DEFAULT_MAX_UPLOAD_FILES_COUNT (2) are the uploader's defaults; the portal overrides them
from its own settings where it has them.
Everything else
Brand and constant lookups
getBrandName and getConstName resolve a key — "ProductName", "BetaLabel", "SSO" —
to the name the current deployment uses. The library ships an identity lookup, so a key
resolves to itself until an application registers a real one:
import {
getBrandName,
setBrandLookup,
} from "@onlyoffice/apps-ui-kit/constants";
getBrandName("ProductName"); // "ProductName" — nothing registered yet
setBrandLookup((key, locale) => myTranslations[locale ?? "en"][key] ?? key);
getBrandName("ProductName"); // "ONLYOFFICE DocSpace"
DocSpace applications register theirs as a side effect of importing
@docspace/shared/constants/brands, so in the portal this is already done.
The lookup is held on globalThis under a Symbol.for key rather than in a module-scope
variable, and that is deliberate. A module-scope variable is only shared by code that
loaded the same copy of the package, and pnpm's isolated layout installs one copy per
distinct peer-resolution set. Those sets diverge easily — which once meant setBrandLookup
ran against one copy while the selectors read another, and every breadcrumb rendered the
literal key ProductName. A realm-global slot survives that.
Enums
enums/ re-exports 38 enumerations. The ones you will reach for most:
Six of these — SdkDateToAutoCleanUp, SdkSortedByType,
SdkFilesSettingsDtoDefaultSharingAccessRightsEnum and the EmployeeFullDto,
FileDtoInteger, GroupDto types below — come from @onlyoffice/docspace-api-sdk and are
re-exported as they are. They move when that dependency is upgraded, so treat them as less
stable than the kit's own.
Types
types/ holds the shared type vocabulary — 31 exports. The portal entity shapes are
TFile, TFolder, TUser, TUserGroup, TLogo, TCreatedBy, ICover and the
TFileSecurity / TFolderSecurity / TRoomSecurity permission sets. The UI vocabulary is
TViewAs, TSortBy, TSortOrder, TDirectionX, TDirectionY, TPathParts,
PathObject, TGetIcon, LinkRouterProps and To.
Four are general-purpose TypeScript helpers worth knowing about:
import type {
Nullable,
ValueOf,
MergeTypes,
WithFlag,
} from "@onlyoffice/apps-ui-kit/types";
type MaybeUser = Nullable<TUser>; // TUser | null
type Device = ValueOf<typeof DeviceType>; // the union of an object's value types