UserPreferencesManager

See source code
Table of contents
class UserPreferencesManager {}

Constructor

Constructs a new instance of the UserPreferencesManager class

Parameters

NameDescription

user

colorScheme

"dark" | "light" | "system";

Properties

disposables

disposables: Set<() => void>;

systemColorScheme

systemColorScheme: import("@tldraw/state").Atom<"dark" | "light", unknown>;

Methods

dispose( )

dispose(): void;

getAnimationSpeed( )

getAnimationSpeed(): number;

getAreKeyboardShortcutsEnabled( )

getAreKeyboardShortcutsEnabled(): boolean;

getColor( )

getColor(): string;

getEdgeScrollSpeed( )

The speed at which the user can scroll by dragging toward the edge of the screen.

getEdgeScrollSpeed(): number;

getEnhancedA11yMode( )

getEnhancedA11yMode(): boolean;

getExternalId( )

The current user's raw, app-provided id — the value set in the user's TLUserPreferences. Use this when you need the id your application assigned to the user. To compare against or look up store records, use UserPreferencesManager.getRecordId instead.

getExternalId(): string;

getId( )

Deprecated: Use UserPreferencesManager.getExternalId for the raw app-provided id, or UserPreferencesManager.getRecordId for the prefixed TLUserId record id.

getId(): string;

getInputMode( )

getInputMode(): "mouse" | "trackpad" | null;

getIsDarkMode( )

getIsDarkMode(): boolean;

getIsDynamicResizeMode( )

getIsDynamicResizeMode(): boolean;

getIsPasteAtCursorMode( )

getIsPasteAtCursorMode(): boolean;

getIsSnapMode( )

getIsSnapMode(): boolean;

getIsWrapMode( )

getIsWrapMode(): boolean;

getIsZoomDirectionInverted( )

getIsZoomDirectionInverted(): boolean;

getLocale( )

getLocale(): string;

getName( )

getName(): string;

getRecordId( )

The current user's id as a tldraw TLUserId record id (prefixed with user:). Use this when comparing against or looking up store records, such as a presence record's userId or followingUserId. For the raw, app-provided id, use UserPreferencesManager.getExternalId.

getRecordId(): TLUserId;

getUserPreferences( )

getUserPreferences(): {
  animationSpeed: number;
  areKeyboardShortcutsEnabled: boolean;
  color: string;
  colorScheme: "dark" | "light" | "system" | undefined;
  enhancedA11yMode: boolean;
  id: string;
  inputMode: "mouse" | "trackpad" | null;
  isDarkMode: boolean;
  isDynamicResizeMode: boolean;
  isSnapMode: boolean;
  isWrapMode: boolean;
  isZoomDirectionInverted: boolean;
  locale: string;
  name: string;
};

updateUserPreferences( )

updateUserPreferences(userPreferences: Partial<TLUserPreferences>): void;

Parameters

NameDescription

userPreferences

Partial<TLUserPreferences>;

Returns

void;

Prev
TransformedGeometry2d
Next
Vec