Selector

February 20, 2026 ยท View on GitHub

Usage

import { Selector } from "@docspace/ui-kit/components/selector";

i18n Setup

The Selector component uses translations for user type labels and other UI text. To enable translations, you need to set up the window.i18n object with loaded translations.

The component reads translations from window.i18n.loaded using the asc_language cookie to determine the current language.

// Set up translations on window object
window.i18n = {
  loaded: {
    "en/Common.json": {
      data: {
        Owner: "Owner",
        PortalAdmin: "{{productName}} admin",
        RoomAdmin: "Room admin",
        User: "Power user",
        Guest: "Guest",
        ProductName: "DocSpace",
        // ... other translations
      },
    },
  },
};

// Set language cookie
document.cookie = "asc_language=en";

Option 2: Using custom translation function

You can pass a custom translation function to components that support it:

import { getUserTypeTranslation } from "@docspace/ui-kit/utils";
import { EmployeeType } from "@docspace/ui-kit/enums";

// With i18next
import { useTranslation } from "react-i18next";

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

  const label = getUserTypeTranslation(EmployeeType.Admin, t);
  // ...
};

// Without translation function (uses window.i18n fallback)
const label = getUserTypeTranslation(EmployeeType.Admin);

Required translation keys

The following translation keys are used by the Selector component:

KeyDescriptionExample
OwnerOwner user type"Owner"
PortalAdminAdmin user type (supports {{productName}} param)"{{productName}} admin"
RoomAdminRoom admin user type"Room admin"
UserPower user type"Power user"
GuestGuest user type"Guest"
ProductNameProduct name for interpolation"DocSpace"
<Selector
  acceptButtonLabel="Add"
  accessRights={[]}
  withoutBackButton={false}
  cancelButtonLabel="Cancel"
  emptyScreenDescription="The list of users previously invited to DocSpace or separate rooms will appear here. You will be able to invite these users for collaboration at any time."
  emptyScreenHeader="No other accounts here yet"
  emptyScreenImage={EmptyScreenFilterPng}
  hasNextPage={false}
  headerLabel="Room list"
  items={[]}
  isLoading={false}
  loadNextPage={() => {}}
  onAccept={function noRefCheck() {}}
  onAccessRightsChange={function noRefCheck() {}}
  onBackClick={function noRefCheck() {}}
  onCancel={function noRefCheck() {}}
  onClearSearch={function noRefCheck() {}}
  onSearch={function noRefCheck() {}}
  onSelect={function noRefCheck() {}}
  onSelectAll={function noRefCheck() {}}
  rowLoader={<></>}
  searchEmptyScreenDescription=" SEARCH !!! The list of users previously invited to DocSpace or separate rooms will appear here. You will be able to invite these users for collaboration at any time."
  searchEmptyScreenHeader="No other accounts here yet search"
  searchEmptyScreenImage={EmptyScreenFilterPng}
  searchLoader={<></>}
  searchPlaceholder="Search"
  searchValue=""
  selectAllIcon={RoomArchiveSvgUrl}
  selectAllLabel="All accounts"
  selectedAccessRight={{}}
  selectedItems={[]}
  totalItems={0}
  withBreadCrumbs={false}
  breadCrumbs={[]}
  onSelectBreadCrumb={function noRefCheck() {}}
  breadCrumbsLoader={<></>}
  withSearch={true}
  isBreadCrumbsLoading={false}
  withFooterInput={false}
  footerInputHeader={""}
  footerCheckboxLabel={""}
  currentFooterInputValue={""}
  alwaysShowFooter={false}
  descriptionText={""}
/>

Properties

PropsTypeRequiredValuesDefaultDescription
idstring---Accepts id
classNamestring---Accepts class
styleobj, array---Accepts css style
headerLabelstring---Selector header text
withoutBackButtonbool---Hide header back button
onBackClickfunc---What the header arrow will trigger when clicked
searchPlaceholderstring---Placeholder for search input
withSearchbool--trueShow search input
onSearchfunc---What the search input will trigger when user stopped typing
onClearSearchfunc---What the clear icon of search input will trigger when clicked
itemsarray---Displaying items
onSelectfunc---What the item will trigger when clicked
isMultiSelectbool--falseAllows you to select multiple objects
selectedItemsarray--[]Tells when the items should present a checked state
acceptButtonLabelstring---Accept button text
onAcceptfunc---What the accept button will trigger when clicked
withSelectAllbool--falseAdd option for select all items
selectAllLabelstring---Text for select all component
selectAllIconstring---Icon for select all component
onSelectAllfunc---What the select all will trigger when clicked
withAccessRightsbool--falseAdd combobox for displaying access rights at footer
accessRightsarray---Access rights items
selectedAccessRightobject---Selected access rights items
onAccessRightsChangefunc---What the access right will trigger when changed
withCancelButtonbool--falseAdd cancel button at footer
cancelButtonLabelstring---Displaying text at cancel button
onCancelfunc---What the cancel button will trigger when clicked
emptyScreenImagestring|node---Image (URL string or SVG element) for default empty screen
emptyScreenHeaderstring---Header for default empty screen
emptyScreenDescriptionstring---Description for default empty screen
searchEmptyScreenImagestring|node---Image (URL string or SVG element) for search empty screen
searchEmptyScreenHeaderstring---Header for search empty screen
searchEmptyScreenDescriptionstring---Description for search empty screen
totalItemsnumber---Count items for infinity scroll
hasNextPagebool---Has next page for infinity scroll
isNextPageLoadingbool---Tells when next page already loading
loadNextPagefunc---Function for load next page
isLoadingbool---Set loading state for select
searchLoadernode---Loader element for search block
rowLoadernode---Loader element for item
withBreadCrumbsbool---Add displaying bread crumbs
breadCrumbsarray---Bread crumbs items
onSelectBreadCrumbfunc---Function for select bread crumb item
breadCrumbsLoadernode---Loader element for bread crumbs
isBreadCrumbsLoadingbool--falseSet loading state for bread crumbs
currentFooterInputValuestring---Current file name
footerCheckboxLabelstring---Title of checkbox
footerInputHeaderstring---Header of new name block
withFooterInputbool--falseShow name change input
alwaysShowFooterbool--falseAlways show buttons
disableAcceptButtonbool--falseDisable click at accept button
descriptionTextstring---Description body text