@docspace/ui-kit

June 25, 2026 · View on GitHub

React UI component library extracted from the ONLYOFFICE DocSpace client codebase.

React

About This Library

@docspace/ui-kit provides React components and a color system extracted from the DocSpace-client monorepo (libs/ui-kit).

ONLYOFFICE DocSpace

Note: This library is currently in early development (v0.0.1). The API may change before a stable release.

Features ✨

  • TypeScript-first - Full type definitions included out of the box
  • Color system - Built-in globalColors palette with named color tokens for light and dark UI states
  • Interactive docs - Every component is documented with Storybook stories and controls
  • Tree-shakeable - Ships both ESM and CJS builds; import only what you use
  • Well-tested - Components are tested with Vitest and React Testing Library
  • Modern tooling - Built with Rollup, linted and formatted with Biome

Requirements

  • React >= 18.0.0
  • React DOM >= 18.0.0

Installation

# pnpm
pnpm add @docspace/ui-kit

# npm
npm install @docspace/ui-kit

# yarn
yarn add @docspace/ui-kit

Peer dependencies: react and react-dom ≥ 18.0.0

Quick Start

Using a Component

import { Text } from "@docspace/ui-kit";

function App() {
  return (
    <Text fontSize="14px" isBold>
      Hello World
    </Text>
  );
}

Using the Color Palette

import { globalColors } from "@docspace/ui-kit/themes/globalColors";

const primaryBlue = globalColors.lightBlueMain;
const errorRed = globalColors.mainRed;

Usage

Import from main entry

import {
  Aside,
  AsideHeader,
  Avatar,
  Backdrop,
  Badge,
  Button,
  Calendar,
  Checkbox,
  CircleSkeleton,
  ComboBox,
  ContextMenu,
  ContextMenuButton,
  DatePicker,
  DateTimePicker,
  DropDown,
  DropDownItem,
  EmailInput,
  EmptyScreenContainer,
  EmptyView,
  FieldContainer,
  FileInput,
  FilterInput,
  Heading,
  HelpButton,
  IconButton,
  InputBlock,
  Label,
  Link,
  Loader,
  LoaderWrapper,
  LoadingButton,
  MCPIcon,
  ModalDialog,
  Portal,
  ProgressBar,
  PublicRoomBar,
  RadioButton,
  RadioButtonGroup,
  RectangleSkeleton,
  RoomIcon,
  RoomLogo,
  Row,
  RowContainer,
  RowContent,
  Scrollbar,
  SearchInput,
  SelectedItem,
  SelectionArea,
  Selector,
  Slider,
  SnackBar,
  StatusMessage,
  TabItem,
  Tabs,
  Tag,
  Tags,
  Text,
  TextInput,
  Textarea,
  ThemeProvider,
  TimePicker,
  Toast,
  toastr,
  ToggleButton,
  Tooltip,
  TopLoaderService,
  BaseTile,
  FileTile,
  FolderTile,
  RoomTile,
  TemplateTile,
  TileContainer,
  TileContent,
} from "@docspace/ui-kit";

Import specific components

import { AccessRightSelect } from "@docspace/ui-kit/components/access-right-select";
import { Aside, AsideHeader } from "@docspace/ui-kit/components/aside";
import { Avatar } from "@docspace/ui-kit/components/avatar";
import { Backdrop } from "@docspace/ui-kit/components/backdrop";
import { Badge } from "@docspace/ui-kit/components/badge";
import { Button, ButtonSize } from "@docspace/ui-kit/components/button";
import { Calendar } from "@docspace/ui-kit/components/calendar";
import { CategoryItem } from "@docspace/ui-kit/components/category-item";
import { Checkbox } from "@docspace/ui-kit/components/checkbox";
import { CircleSkeleton } from "@docspace/ui-kit/components/circle";
import { ColorInput } from "@docspace/ui-kit/components/color-input";
import { ColorPicker } from "@docspace/ui-kit/components/color-picker";
import { ComboBox } from "@docspace/ui-kit/components/combobox";
import { ContextMenu } from "@docspace/ui-kit/components/context-menu";
import { ContextMenuButton, ContextMenuButtonDisplayType } from "@docspace/ui-kit/components/context-menu-button";
import { DatePicker } from "@docspace/ui-kit/components/date-picker";
import { DateTimePicker } from "@docspace/ui-kit/components/date-time-picker";
import { DragAndDrop } from "@docspace/ui-kit/components/drag-and-drop";
import { DropDown } from "@docspace/ui-kit/components/drop-down";
import { DropDownItem } from "@docspace/ui-kit/components/drop-down-item";
import { Dropzone } from "@docspace/ui-kit/components/dropzone";
import { EmailInput } from "@docspace/ui-kit/components/email-input";
import { EmptyScreenContainer } from "@docspace/ui-kit/components/empty-screen-container";
import { EmptyView } from "@docspace/ui-kit/components/empty-view";
import { ErrorContainer } from "@docspace/ui-kit/components/error-container";
import { FieldContainer } from "@docspace/ui-kit/components/field-container";
import { FileInput } from "@docspace/ui-kit/components/file-input";
import { FilterInput } from "@docspace/ui-kit/components/filter";
import { FloatingButton, FloatingButtonIcons } from "@docspace/ui-kit/components/floating-button";
import { FormWrapper } from "@docspace/ui-kit/components/form-wrapper";
import { Heading, HeadingLevel, HeadingSize } from "@docspace/ui-kit/components/heading";
import { HelpButton } from "@docspace/ui-kit/components/help-button";
import { IconButton } from "@docspace/ui-kit/components/icon-button";
import { ImageEditor } from "@docspace/ui-kit/components/image-editor";
import { InfiniteLoaderComponent } from "@docspace/ui-kit/components/infinite-loader";
import { InputBlock } from "@docspace/ui-kit/components/input-block";
import { Label } from "@docspace/ui-kit/components/label";
import { Link, LinkType, LinkTarget } from "@docspace/ui-kit/components/link";
import { LinkWithDropdown } from "@docspace/ui-kit/components/link-with-dropdown";
import { Loader, LoaderTypes } from "@docspace/ui-kit/components/loader";
import { LoaderWrapper } from "@docspace/ui-kit/components/loader-wrapper";
import { LoadingButton } from "@docspace/ui-kit/components/loading-button";
import { MainButton } from "@docspace/ui-kit/components/main-button";
import { MainButtonMobile } from "@docspace/ui-kit/components/main-button-mobile";
import { MCPIcon, MCPIconSize } from "@docspace/ui-kit/components/mcp-icon";
import { ModalDialog, ModalDialogType } from "@docspace/ui-kit/components/modal-dialog";
import { Navigation } from "@docspace/ui-kit/components/navigation";
import { OperationsProgressButton } from "@docspace/ui-kit/components/operations-progress-button";
import { Paging } from "@docspace/ui-kit/components/paging";
import { PasswordInput } from "@docspace/ui-kit/components/password-input";
import { Portal } from "@docspace/ui-kit/components/portal";
import { PortalLogo } from "@docspace/ui-kit/components/portal-logo";
import { ProgressBar, PreparationPortalProgress } from "@docspace/ui-kit/components/progress-bar";
import { PublicRoomBar } from "@docspace/ui-kit/components/public-room-bar";
import { RadioButton } from "@docspace/ui-kit/components/radio-button";
import { RadioButtonGroup } from "@docspace/ui-kit/components/radio-button-group";
import { RectangleSkeleton } from "@docspace/ui-kit/components/rectangle";
import { RoomIcon } from "@docspace/ui-kit/components/room-icon";
import { RoomLogo } from "@docspace/ui-kit/components/room-logo";
import { Row, RowContainer, RowContent } from "@docspace/ui-kit/components/rows";
import { Scrollbar } from "@docspace/ui-kit/components/scrollbar";
import { SearchInput } from "@docspace/ui-kit/components/search-input";
import { Section } from "@docspace/ui-kit/components/section";
import { SelectedItem } from "@docspace/ui-kit/components/selected-item";
import { SelectionArea } from "@docspace/ui-kit/components/selection-area";
import { Selector, SelectorAccessRightsMode } from "@docspace/ui-kit/components/selector";
import { Slider } from "@docspace/ui-kit/components/slider";
import { SnackBar } from "@docspace/ui-kit/components/snackbar";
import { StatusMessage } from "@docspace/ui-kit/components/status-message";
import { TabItem } from "@docspace/ui-kit/components/tab-item";
import { TableContainer, TableBody, TableRow, TableHeader, TableGroupMenu, TableCell } from "@docspace/ui-kit/components/table";
import { Tabs, TabsTypes } from "@docspace/ui-kit/components/tabs";
import { Tag } from "@docspace/ui-kit/components/tag";
import { Tags } from "@docspace/ui-kit/components/tags";
import { Text } from "@docspace/ui-kit/components/text";
import { TextInput, InputSize, InputType } from "@docspace/ui-kit/components/text-input";
import { Textarea } from "@docspace/ui-kit/components/textarea";
import { ThemeProvider } from "@docspace/ui-kit/components/theme-provider";
import { TimePicker } from "@docspace/ui-kit/components/time-picker";
import { Toast, toastr } from "@docspace/ui-kit/components/toast";
import { ToggleButton } from "@docspace/ui-kit/components/toggle-button";
import { Tooltip, TooltipContainer, withTooltip } from "@docspace/ui-kit/components/tooltip";
import { TopLoaderService } from "@docspace/ui-kit/components/top-loading-indicator";
import { BaseTile, FileTile, FolderTile, RoomTile, TemplateTile, TileContainer, TileContent } from "@docspace/ui-kit/components/tiles";

Import contexts and hooks

import { ThemeProvider, useTheme } from "@docspace/ui-kit/context/ThemeContext";
import { InterfaceDirectionProvider, useInterfaceDirection } from "@docspace/ui-kit/context/InterfaceDirectionContext";

import { useAnimation } from "@docspace/ui-kit/hooks/useAnimation";
import { useDebounce } from "@docspace/ui-kit/hooks/useDebounce";
import { useEventListener } from "@docspace/ui-kit/hooks/useEventListener";
import { useIsomorphicLayoutEffect } from "@docspace/ui-kit/hooks/useIsomorphicLayoutEffect";

Import providers

import { Providers } from "@docspace/ui-kit/providers";
import { ApiProvider, useApi } from "@docspace/ui-kit/providers/api";
import { ErrorBoundary } from "@docspace/ui-kit/providers/error-boundary";
import { TranslationProvider, useI18N } from "@docspace/ui-kit/providers/translation";
import { ThemeProvider } from "@docspace/ui-kit/providers/theme";
import type { TTranslations } from "@docspace/ui-kit/providers/translation";

Import errors

import { Error401, Error403, Error404, ErrorOfflineContainer, ErrorInvalidLink, ErrorUnavailable, AccessRestricted } from "@docspace/ui-kit/errors";

Import utilities

import { isMobile, isTablet, isDesktop, checkIsSSR } from "@docspace/ui-kit/utils";
import commonIconsStyles, { IconSizeType, isIconSizeType } from "@docspace/ui-kit/utils/common-icons-style";
import DomHelpers from "@docspace/ui-kit/utils/dom-helpers";
import { useClickOutside } from "@docspace/ui-kit/utils/use-click-outside";
import { getCommonTranslation } from "@docspace/ui-kit/utils/i18n";
import { combineUrl } from "@docspace/ui-kit/utils/combineUrl";
import { getCookie, setCookie, deleteCookie } from "@docspace/ui-kit/utils/cookie";
import { parseAddress, parseAddresses, EmailSettings } from "@docspace/ui-kit/utils/email";

Import enums, constants, and types

import { ShareAccessRights, EmployeeType, RoomsType, ThemeKeys, FileType, FolderType } from "@docspace/ui-kit/enums";
import { LOADER_STYLE, OPERATIONS_NAME, EMPTY_ARRAY, EMPTY_OBJECT } from "@docspace/ui-kit/constants";
import type { TFile, TFolder, TUser, TFileSecurity, TFolderSecurity, TRoomSecurity } from "@docspace/ui-kit/types";

Components

ComponentDescription
AccessRightSelectDropdown selector for managing access rights and permissions on resources
AddButtonButton component for adding items with optional label, loading state, and accent styling
AppLoaderFull-page loading spinner displayed during application initialization
ArticleResponsive sidebar panel with header, main button, and body sections for navigation
AsideSliding panel component for displaying side content like settings, details, or forms
AsideHeaderHeader component for aside panels with optional back/close buttons, custom icons, and loading states
AvatarComponent for displaying user or group avatars with images, initials, icons, and role indicators
BackdropCustomizable overlay for modals, dialogs, and aside components with touch support
BadgeVersatile badge for notifications, status markers, or interactive elements with various display modes
ButtonVersatile button component with primary/secondary variants, multiple sizes, loading states, and tooltip support
CalendarCustom calendar component for date selection
CategoryItemNavigation link item with optional badge and arrow indicator for menu hierarchies
ChatAI chat interface with streaming responses, message history, file attachments, and AI tools integration
CheckboxCustomizable checkbox with indeterminate and error states
CircleSkeletonCircular skeleton loader for avatar and icon placeholders
ColorInputText input for entering and validating color values
ColorPickerInteractive color selection component for choosing colors visually
ComboBoxCombo box combining text input with dropdown list, supporting search and custom styling
ContextMenuContext menu for displaying contextual actions with submenus, headers, toggles, and hotkeys
ContextMenuButtonButton for displaying context menu actions on list items with dropdown support
DatePickerDate picker input component for selecting dates
DateTimePickerCombined date and time input component
DragAndDropFile drag-and-drop handler for upload operations
DropDownDropdown component for menus, options, and contextual content with auto-positioning
DropDownItemDropdown item for menus and lists with separator, header, submenu, and toggle support
DropzoneInteractive file drop area with visual feedback and file type restrictions
EmailInputEmail address input with built-in validation and error reporting
EmptyScreenContainerComponent for displaying empty states with image, text, and action buttons
EmptyViewEmpty state component with icon, title, description, and interactive options
ErrorContainerFull-page error display with decorative background, message, and action button
FieldContainerContainer wrapper for form fields with consistent spacing and styling
FileInputFile entry field
FilterInputFilter component with search, sorting, and view options for data filtering
FloatingButtonCircular floating action button with progress indicator and alert icon
FormWrapperWrapper for form elements providing consistent form styling and layout
HeadingHeading text structured in levels with customizable sizes and types
HelpButtonInfo icon button that triggers a tooltip with help content
IconButtonButton component displaying an icon with hover, click, and disabled states
ImageEditorImage cropping and editing component with file upload and preview support
InfiniteLoaderVirtualized infinite scroll container for loading items progressively
InputBlockInput component combining text input with optional icon and children elements
LabelForm label with required indicator and tooltip support
LinkHyperlink component with page and action types
LinkWithDropdownLink that opens a dropdown menu with additional options
LoaderLoading indicator with multiple animation types
LoaderWrapperWrapper that dims children and blocks interactions during loading
LoadingButtonCircular button with animated progress bar and completion indicator
MainButtonPrimary action button with optional dropdown menu for desktop
MainButtonMobileFloating action button with expandable menu for mobile interface
MCPIconIcon component for MCP (Model Context Protocol) with image or text fallback
ModalDialogVersatile modal dialog component supporting both modal and aside (side panel) display types with keyboard shortcuts
NavigationBreadcrumb navigation with expandable hierarchical sections
OperationsProgressButtonOperation progress tracker for multiple concurrent operations with error checking
PagingPagination controls for navigating through pages of data
PasswordInputPassword input with strength validation, generator, and reveal/hide toggle
PortalRenders children into a different DOM node
PortalLogoResponsive logo component with fallback handling
ProgressBarVisual progress indicator bar and portal preparation progress display
PublicRoomBarInformation bar for public room notifications with header, body text, and close button
RadioButtonRadio button component with customizable labels and styles
RadioButtonGroupGroup of radio buttons with horizontal/vertical layouts and text labels
RectangleSkeletonRectangular skeleton loader for text, buttons, and content placeholders
RoomIconRoom icon component with support for images, colors, badges, editing, and various states
RoomLogoRoom logo component displaying room type icons with archive, template, and checkbox support
RowVersatile list row with checkbox, context menu, badges, and modern/default layouts for file or member listings
RowContainerWrapper for rendering multiple rows with optional react-window virtualization and infinite loading
RowContentLayout helper that arranges row title, icons, and side sections while generating tablet-friendly summaries
ScrollbarCustom scrollbar component with auto-hide, RTL support, and flexible styling options
SearchInputSearch input component with auto-refresh, clear button, and debounce support
SectionPage layout with header, filter, body, footer, info panel, and operations progress sections
SelectedItemComponent for displaying selected items with remove functionality
SelectionAreaMouse-driven rectangular selection area for selecting multiple items
SelectorDropdown selector with access rights modes for item selection with permissions
SliderRange input slider with optional fill visualization and RTL support
SnackBarToast notification component for temporary messages and alerts
StatusMessageAnimated status message component for displaying error and warning messages
TabItemTab navigation component with active states, multi-select, and disabled state support
TableContainerModular table with body, row, header, group menu, and cell sub-components
TabsTab container component with primary/secondary themes, sticky positioning, and content management
TagTag component for displaying virtual room tags
TagsContainer component for displaying multiple tags
TextTypography component with various styling options
TextInputInput field for single-line strings with masking support
TextareaMulti-line text input with JSON formatting, line numbers, and copy functionality
ThemeProviderProvider component for theme management with styled-components integration
TimePickerTime input component for selecting time values
ToastNotification component with success, error, warning, and info variants (see i18n Setup)
ToggleButtonCustomizable toggle button with loading and disabled states
TooltipCustomizable tooltip with multiple trigger options
TopLoaderServiceTop page progress bar service with start(), end(), cancel() static methods
BaseTileBase tile component providing foundational structure for all tile components
FileTileFile tile component for displaying file information with thumbnail preview
FolderTileFolder tile component with support for compact and big folder views
RoomTileRoom tile component for displaying room information with tags and metadata
TemplateTileTemplate tile component with owner and storage metadata
TileContainerContainer for organizing tiles in a grid layout with automatic categorization
TileContentContent wrapper component for tile children with consistent styling

Contexts

ContextDescription
ThemeContextTheme management context with support for Base/Dark themes and custom color schemes
InterfaceDirectionContextInterface direction context for managing LTR/RTL layout support

Hooks

HookDescription
useAnimationManages animation state with phases (none/start/progress/finish), dispatches custom window events, and returns refs and triggerAnimation()
useDebounceDebounces callback execution with configurable delay and automatic cleanup on unmount
useEventListenerTyped event listener hook for Window, HTML/SVG elements, Document, and MediaQueryList with automatic cleanup
useIsomorphicLayoutEffectSSR-safe effect hook — uses useLayoutEffect in browser, useEffect on server

Providers

Composed providers that wrap your application with error handling, API access, translations, and theming.

ProviderDescription
ProvidersAll-in-one composition of ErrorBoundary, ApiProvider, TranslationProvider, and ThemeProvider
ApiProviderCreates React Context with profilesApi and commonSettingsApi from @onlyoffice/docspace-api-sdk
ErrorBoundaryClass component that catches render errors with custom fallback UI and onError callback
TranslationProviderWraps I18nextProvider and initializes i18next with translation resources
ThemeProviderResolves theme (Base/Dark/System), fetches color themes, monitors system preferences

Quick Start

import { Providers } from "@docspace/ui-kit/providers";
import enCommon from "@docspace/ui-kit/locales/en/Common.json";
import type { TTranslations } from "@docspace/ui-kit/providers/translation";

const translations: TTranslations = new Map([
  ["en", new Map([["Common", enCommon]])],
]);

<Providers
  url="https://your-docspace.com"
  apiKey="your-api-key"
  translations={translations}
  locale="en"
>
  <App />
</Providers>

See Providers with i18n for full internationalization guide.

Errors

Pre-built error page components that wrap ErrorContainer with localized messages via getCommonTranslation.

ComponentTranslation KeyDescription
Error401Error401TextUnauthorized access error
Error403Error403TextForbidden access error
Error404Error404TextPage not found error
ErrorOfflineContainerErrorOfflineTextOffline / no connection error
ErrorInvalidLinkInvalidLink, LinkDoesNotExistInvalid or expired link error
ErrorUnavailableErrorDeactivatedTextPortal deactivated error
AccessRestrictedAccessDenied, PortalRestrictionAccess restricted error
import { Error401, Error403, Error404 } from "@docspace/ui-kit/errors";

Utilities

UtilityDescription
common-icons-styleStyled-components CSS helper for consistent icon sizing with IconSizeType enum
combineUrlMerges base URL with path segments, handling trailing/leading slashes
commongetUserTypeTranslation for employee role types, RoomsTypeValues, RoomsTypes helpers
contextReact context with optional sectionWidth and sectionHeight
cookiegetCookie, setCookie, deleteCookie — cookie management with asc_language special handling
dateDate utilities: formatting, arithmetic, comparison, duration, timezone, and parsing
deviceDevice detection utilities: isMobile, isTablet, isDesktop, checkIsSSR
dom-helpersDOM utilities for viewport, element positioning, scrollbar width, and z-index management
edge-scrollingAuto-scrolls when mouse is near viewport edges — used for drag-and-drop operations
emailEmail parsing and validation: parseAddress, parseAddresses, EmailSettings, isValidDomainName
get-system-themeReturns system theme preference (Dark or Base) from AscDesktopEditor or prefers-color-scheme
get-text-colorDetermines optimal text color (black/white) for a background based on perceived brightness
getFilesFromEventConverts drag/drop/paste/input events to File arrays with recursive directory handling
getLogoUrlGenerates logo URL using WhiteLabelLogoType enum with culture and theme parameters
hasOwnPropertySafe Object.hasOwn check with try-catch that handles null/undefined
i18ngetCommonTranslation(key) — retrieves localized strings from window.i18n
openingNewTabDetects middle-click / Ctrl+Click / Cmd+Click to open URLs in new tabs
trim-separatorCleans up context menu arrays by removing redundant separators and disabled items
use-click-outsideReact hook for detecting clicks outside an element, useful for dropdowns and modals
uuidUUID v4 generation utility for unique identifiers
add-logConditionally logs to the browser console or accumulates messages in window.logs based on ClientConfig settings
getTitleWithoutExtensionStrips the file extension from a title string, returning the bare name
image-helpersGenerates Maps of file extension → SVG icon URL for 24 / 32 / 64 / 96 px icon sizes across document and folder types
presentInArrayChecks whether a string exists in an array with optional case-insensitive comparison
socketSocketHelper singleton for managing WebSocket connections, event subscriptions, and message emission with typed event/command enums
typeGuardsType guard that checks whether a value is a Next.js StaticImageData object (src, height, width)

Enums

Shared enums available from @docspace/ui-kit/enums:

EnumValues
ShareAccessRightsNone, FullAccess, ReadOnly, DenyAccess, Varies, Review, Comment, FormFilling, CustomFilter, RoomManager, Editing, Collaborator
EmployeeTypeOwner, Admin, RoomAdmin, User, Guest
RoomsTypePublicRoom, FormRoom, EditingRoom, VirtualDataRoom, CustomRoom, AIRoom
EmployeeStatusActive, Disabled, Pending
FileTypeUnknown, Archive, Video, Audio, Image, Spreadsheet, Presentation, Document, etc.
FolderTypeDEFAULT, CommonDocuments, MyDocuments, Favorites, Recent, Trash, Archive, Rooms, etc.
ThemeKeysBaseStr, DarkStr, SystemStr

Constants

Shared constants from @docspace/ui-kit/constants:

ConstantDescription
LOADER_STYLESkeleton loading configuration (width, opacity, speed)
OPERATIONS_NAMEOperation type identifiers (trash, download, copy, move, convert)
ROOM_ACTION_KEYSRoom editing action keys
EMPTY_ARRAYFrozen empty array for stable references
EMPTY_OBJECTFrozen empty object for stable references
FUNCTION_EMPTYNo-op function
LANGUAGECookie name constant: "asc_language"

Types

Key TypeScript types from @docspace/ui-kit/types:

TypeDescription
TFileComprehensive file object with security, status, and metadata
TFolderFolder object with security and access rights
TUserUser/employee data including avatar, status, admin flags, quota
TCreatedByAuthor info: avatar, displayName, id, profileUrl
TLogoLogo object with multiple sizes
TFileSecurityDetailed file access rights
TFolderSecurityDetailed folder access rights
TRoomSecurityDetailed room access rights
TViewAsView mode: "tile", "table", "row", "settings", "profile"

Selectors

VariantItem typeDescription
Users SelectorTSelectorItemUserPicks workspace members; rows show avatar, role badge, employee type label, and group membership
Groups SelectorTSelectorItemGroupPicks user groups; distinguishes regular groups from system-managed ones
Files SelectorTSelectorItemFilePicks files; rows show file-type icon and extension label
Folders SelectorTSelectorItemFolderPicks folders; rows show folder icon with nested file and subfolder counts
Rooms SelectorTSelectorItemRoomPicks rooms; rows show room icon, cover image, tags, and room-type badge
MCP SelectorTSelectorItemMCPPicks Model Context Protocol agents; rows show agent icon and name

Theming

The library ships with globalColors - 100+ named color tokens. It can be imported directly or via the themes entry point:

import { globalColors } from "@docspace/ui-kit/themes/globalColors";
// or
import { globalColors } from "@docspace/ui-kit/themes";

// Base
const white = globalColors.white; // "#ffffff"
const black = globalColors.black; // "#333333"

const primary = globalColors.lightBlueMain;
const success = globalColors.mainGreen;
const error = globalColors.mainRed;
const warning = globalColors.mainOrange;

i18n Setup

Several components support automatic localization from window.i18n. This includes:

  • Toast - automatic titles for success/error/warning/info notifications
  • DropDownItem - beta and paid badge labels
  • Selector - empty screen texts, button labels, and error messages
  • Error pages - all error messages (Error401, Error403, Error404, etc.)

Setup

Set up window.i18n with your translations:

window.i18n = {
  loaded: {
    "en/Common.json": {
      data: {
        // Toast titles
        Done: "Done",
        Warning: "Warning",
        Alert: "Alert",
        Info: "Info",
        // DropDownItem badges
        BetaLabel: "Beta",
        Paid: "Paid",
        // Selector
        ClearFilter: "Clear filter",
        Back: "Back",
        ContainsSpecCharacter: "Contains special characters",
        NoRoomsFound: "No rooms found",
        SelectorFormRoomEmptyScreenDescription: "Create a form filling room...",
        SelectorVDREmptyScreenDescription: "Create a virtual data room...",
        CreateFormFillingRoom: "Create form filling room",
        CreateVirtualDataRoom: "Create virtual data room",
        // FileInput
        NotSupportedFormat: "Sorry, this file format isn't supported",
      },
    },
    "ru/Common.json": {
      data: {
        Done: "Готово",
        Warning: "Предупреждение",
        Alert: "Внимание",
        Info: "Информация",
        BetaLabel: "Бета",
        Paid: "Платно",
        ClearFilter: "Очистить фильтр",
        Back: "Назад",
        // ... other translations
      },
    },
    // Add more languages as needed
  },
};

Language Detection

Components read the language from the asc_language cookie. The language mapping:

  • en-US, en-GBen
  • Other values are used as-is (e.g., ru, de, fr)

Translation Keys by Component

ComponentTranslation Keys
ToastDone, Warning, Alert, Info
DropDownItemBetaLabel, Paid
SelectorClearFilter, Back, ContainsSpecCharacter, NoRoomsFound, SelectorFormRoomEmptyScreenDescription, SelectorVDREmptyScreenDescription, CreateFormFillingRoom, CreateVirtualDataRoom

Using getCommonTranslation utility

You can import and use the getCommonTranslation utility directly:

import { getCommonTranslation } from "@docspace/ui-kit/utils";

const title = getCommonTranslation("Done"); // Returns localized "Done" or undefined
const label = getCommonTranslation("BetaLabel"); // Returns localized "BetaLabel" or undefined

Providers with i18n

The Providers component integrates i18next for full internationalization support. This is the recommended approach for applications that need proper i18n with React hooks (useTranslation), automatic language detection, and the window.i18n bridge for standalone components.

How It Works

  1. TranslationProvider initializes an i18next instance with your translations
  2. It wraps children in I18nextProvider from react-i18next
  3. It also sets window.i18n.t and window.i18n.loaded so standalone components (Toast, DropDownItem, Selector, Error pages) can read translations without React context

Translation Data Structure

Translations use a TTranslations type — a nested Map:

type TTranslations = Map<
  string,                              // language code (e.g., "en", "ru", "fr")
  Map<
    string,                            // namespace (always "Common")
    Record<string, string>             // key-value translation pairs
  >
>;

Step-by-Step Setup

1. Import locale files

The library ships with locale files for 32 languages under @docspace/ui-kit/locales/:

import enCommon from "@docspace/ui-kit/locales/en/Common.json";
import ruCommon from "@docspace/ui-kit/locales/ru/Common.json";
import deCommon from "@docspace/ui-kit/locales/de/Common.json";
import frCommon from "@docspace/ui-kit/locales/fr/Common.json";
// ... add as many languages as you need

Available locales: ar-SA, az, bg, cs, de, el-GR, en, es, fi, fr, hy-AM, it, ja-JP, ko-KR, lo-LA, lv, nl, pl, pt, pt-BR, ro, ru, si, sk, sl, sq-AL, sr-Cyrl-RS, sr-Latn-RS, tr, uk-UA, vi, zh-CN.

2. Build the translations map

import type { TTranslations } from "@docspace/ui-kit/providers/translation";

const translations: TTranslations = new Map([
  ["en", new Map([["Common", enCommon]])],
  ["ru", new Map([["Common", ruCommon]])],
  ["de", new Map([["Common", deCommon]])],
  ["fr", new Map([["Common", frCommon]])],
]);

3. Wrap your app with Providers

import { Providers } from "@docspace/ui-kit/providers";

function App() {
  return (
    <Providers
      url="https://your-docspace.com"
      apiKey="your-api-key"
      translations={translations}
      locale="en"
      initialTheme="BaseStr"
      errorFallback={(error) => <div>Error: {error.message}</div>}
      onError={(error, errorInfo) => console.error(error, errorInfo)}
    >
      <YourApp />
    </Providers>
  );
}

4. Use translations in components

Inside the provider tree, use react-i18next hooks:

import { useTranslation } from "react-i18next";

function MyComponent() {
  const { t } = useTranslation("Common");

  return (
    <div>
      <h1>{t("Settings")}</h1>
      <button>{t("SaveButton")}</button>
      <button>{t("CancelButton")}</button>
    </div>
  );
}

Language Resolution

The TranslationProvider resolves the active language in this priority order:

  1. locale prop (explicit override)
  2. user.cultureName (from user profile)
  3. settings.culture (from portal settings)
  4. "en" (fallback)

If settings and user are not passed as props, they are fetched automatically from the DocSpace API using the url and apiKey provided.

Props Reference

PropTypeRequiredDescription
urlstringYesBase URL of the DocSpace API
apiKeystringYesAPI key for authentication
translationsTTranslationsNoTranslation resources map
localestringNoLocale override (e.g., "en", "ru")
settingsSettingsDtoNoPortal settings (fetched from API if not provided)
userEmployeeFullDtoNoCurrent user (fetched from API if not provided)
initialThemeThemeKeysNoInitial theme: "BaseStr", "DarkStr", "SystemStr"
systemThemeThemeKeysNoOverride for system theme detection
colorThemeCustomColorThemesSettingsDtoNoColor theme data
errorFallbackReactNode | ((error: Error) => ReactNode)NoCustom error UI
onError(error: Error, errorInfo: ErrorInfo) => voidNoError callback
childrenReactNodeYesChild components

Using Individual Providers

You can also use sub-providers individually for more control:

import { ApiProvider } from "@docspace/ui-kit/providers/api";
import { TranslationProvider } from "@docspace/ui-kit/providers/translation";
import { ThemeProvider } from "@docspace/ui-kit/providers/theme";
import { ErrorBoundary } from "@docspace/ui-kit/providers/error-boundary";

<ErrorBoundary fallback={<ErrorPage />}>
  <ApiProvider url="https://your-docspace.com" apiKey="your-api-key">
    <TranslationProvider
      translations={translations}
      locale="en"
      settings={settings}
      user={user}
    >
      <ThemeProvider initialTheme="BaseStr" locale="en">
        <App />
      </ThemeProvider>
    </TranslationProvider>
  </ApiProvider>
</ErrorBoundary>

Using the useApi hook

Inside ApiProvider, access API clients via the useApi hook:

import { useApi } from "@docspace/ui-kit/providers/api";

function MyComponent() {
  const { profilesApi, commonSettingsApi } = useApi();

  useEffect(() => {
    profilesApi.getSelfProfile().then((res) => {
      console.log(res.data.response);
    });
  }, [profilesApi]);
}

Development

Clone this repository or work within the DocSpace-client monorepo and run:

Storybook - interactive component explorer

pnpm storybook

Opens at http://localhost:6006 - browse components, tweak props with the controls panel, and see live previews.

Tests

pnpm test           # run all tests once
pnpm test:watch     # watch mode
pnpm test:coverage  # with coverage report
pnpm test:ui        # Vitest UI dashboard

Build

pnpm build          # production build (ESM + CJS + type declarations)
pnpm build:watch    # rebuild on file changes

Lint & Format

pnpm lint           # check for lint issues
pnpm lint:fix       # auto-fix lint issues
pnpm format         # check lint and formatting
pnpm format:fix     # auto-fix lint and formatting
ResourceURL
🌐 ONLYOFFICE Websiteonlyoffice.com
🐙 DocSpace-client Monorepogithub.com/ONLYOFFICE/DocSpace-client
📖 ONLYOFFICE APIapi.onlyoffice.com
💬 Community Forumcommunity.onlyoffice.com
🆘 Help Centerhelpcenter.onlyoffice.com
📣 Feedbackfeedback.onlyoffice.com

Contributing

Issues and feature requests are tracked in the DocSpace-client repository. Contributions are welcome - please open an issue or PR there, or start a discussion on the community forum.

License

This library is distributed under the GNU AGPL v3 license. See the source files for the full license text.