TldrawBaseProps
See source codeTable of contents
- acceptedImageMimeTypes
- acceptedVideoMimeTypes
- assetUrls
- autoFocus
- bindingUtils
- cameraOptions
- children
- className
- components
- deepLinks
- embeds
- forceMobile
- hideUi
- inferDarkMode
- initialState
- licenseKey
- maxAssetSize
- maxImageDimension
- mediaMimeTypes
- onMount
- onUiEvent
- options
- overrides
- shapeUtils
- textOptions
- tools
- user
- Properties
- Methods
Extends TldrawUiProps, TldrawEditorBaseProps, TLExternalContentProps.
interface TldrawBaseProps
extends TldrawUiProps,
TldrawEditorBaseProps,
TLExternalContentProps {}Properties
acceptedImageMimeTypes
The mime types of images that are allowed to be handled. Defaults to DEFAULT_SUPPORTED_IMAGE_TYPES.
acceptedImageMimeTypes?: readonly string[]acceptedVideoMimeTypes
The mime types of videos that are allowed to be handled. Defaults to DEFAULT_SUPPORT_VIDEO_TYPES.
acceptedVideoMimeTypes?: readonly string[]assetUrls
Urls for custom assets.
⚠︎ Important! This must be memoized (with useMemo) or defined outside of any React component.
assetUrls?: TLUiAssetUrlOverridesautoFocus
Whether to automatically focus the editor when it mounts.
autoFocus?: booleanbindingUtils
An array of binding utils to use in the editor.
bindingUtils?: readonly TLAnyBindingUtilConstructor[]cameraOptions
Camera options for the editor.
cameraOptions?: Partial<TLCameraOptions>children
The component's children.
children?: ReactNodeclassName
A classname to pass to the editor's container.
className?: stringcomponents
Overrides for tldraw's components.
⚠︎ Important! This must be memoized (with useMemo) or defined outside of any React component.
components?: TLComponentsdeepLinks
Options for syncing the editor's camera state with the URL.
deepLinks?: TLDeepLinkOptions | trueembeds
Custom definitions for tldraw's embeds.
⚠︎ Important! This must be memoized (with useMemo) or defined outside of any React component.
embeds?: TLEmbedDefinition[]forceMobile
Whether to always should the mobile breakpoints.
forceMobile?: booleanhideUi
Whether to hide the user interface and only display the canvas.
hideUi?: booleaninferDarkMode
Whether to infer dark mode from the user's OS. Defaults to false.
inferDarkMode?: booleaninitialState
The editor's initial state (usually the id of the first active tool).
initialState?: stringlicenseKey
The license key.
licenseKey?: stringmaxAssetSize
The maximum size (in bytes) of an asset. Assets larger than this will be rejected. Defaults to 10mb (10 * 1024 * 1024).
maxAssetSize?: numbermaxImageDimension
The maximum dimension (width or height) of an image. Images larger than this will be rescaled to fit. Defaults to infinity.
maxImageDimension?: numbermediaMimeTypes
Supported mime types for media files.
mediaMimeTypes?: string[]onMount
Called when the editor has mounted.
onMount?: TLOnMountHandleronUiEvent
Callback for when an event occurs in the UI.
onUiEvent?: TLUiEventHandleroptions
Options for the editor.
options?: Partial<TldrawOptions>overrides
Overrides for the UI.
overrides?: TLUiOverrides | TLUiOverrides[]shapeUtils
An array of shape utils to use in the editor.
shapeUtils?: readonly TLAnyShapeUtilConstructor[]textOptions
Text options for the editor.
textOptions?: TLTextOptionstools
An array of tools to add to the editor's state chart.
tools?: readonly TLStateNodeConstructor[]user
The user interacting with the editor.
user?: TLUserMethods
getShapeVisibility
Provides a way to hide shapes.
Hidden shapes will not render in the editor, and they will not be eligible for hit test via and . But otherwise they will remain in the store and participate in all other operations.
Example
getShapeVisibility={(shape, editor) => shape.meta.hidden ? 'hidden' : 'inherit'}'inherit' | undefined- (default) The shape will be visible unless its parent is hidden.'hidden'- The shape will be hidden.'visible'- The shape will be visible.
Parameters
Returns
'hidden' | 'inherit' | 'visible' | null | undefinedrenderDebugMenuItems
Additional items to add to the debug menu (will be deprecated)