Home > @uniformdev/canvas-react

canvas-react package

Functions

<table><thead><tr><th>

Function

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

convertComponentToProps(component)

</td><td>

Converts a raw Canvas component instance to React component props format. This merges each parameter moved to the root object and removes the 'value' node, hugely simplifying rendering code. For example if the raw object has parameters.foo.value, then the final props have props.foo === raw.parameters.foo.value.

</td></tr> <tr><td>

createComponentStore()

</td><td>

</td></tr> <tr><td>

createComponentStoreResolver(options)

</td><td>

</td></tr> <tr><td>

DefaultNotImplementedComponent(props)

</td><td>

A default implementation of a component-not-implemented component. Useful for model-first workflows where frontend dev comes later. To make this work, it needs to be the default returned from the resolveRenderer() function when the component is unknown.

</td></tr> <tr><td>

registerUniformComponent({ type, variantId, component, })

</td><td>

</td></tr> <tr><td>

UniformComponent({ data, resolveRenderer, children, behaviorTracking, contextualEditingDefaultPlaceholder, })

</td><td>

Allows the rendering of a Canvas component instance (root or not), and its children if it has any. Note that the actual rendering happens inside <UniformSlot />, which you should use in most cases.

</td></tr> <tr><td>

UniformComposition({ data, behaviorTracking, children, resolveRenderer, contextualEditingEnhancer, contextualEditingDefaultPlaceholder, })

</td><td>

The main component to render a Canvas composition. It renders the full tree of components, and provides some services to the children, such as useUniformCurrentComposition. It also takes care of enabling [Contextual Editing](https://docs.uniform.app/capabilities/composition/contextual-editing).

</td></tr> <tr><td>

UniformPlayground({ resolveRenderer, decorators, contextualEditingEnhancer, behaviorTracking, contextualEditingDefaultPlaceholder, children, })

</td><td>

Playground where you can freely live preview your components and pattern.

</td></tr> <tr><td>

UniformRichTextNode({ node, ...props })

</td><td>

Render a single RichText node

</td></tr> <tr><td>

UniformSlot({ name, resolveRenderer, children, emptyPlaceholder, wrapperComponent, })

</td><td>

Renders a named Slot within a Composition.

</td></tr> <tr><td>

UniformText({ as: tag, parameterId, isMultiline, placeholder, render, ...props })

</td><td>

Renders text parameters. Offers inline editing capability out of the box.

</td></tr> <tr><td>

useCompositionEventEffect({ enabled, projectId, compositionId, effect, })

</td><td>

Hook to manage a subscription to a realtime event on a composition

</td></tr> <tr><td>

useUniformContextualEditing({ initialCompositionValue, enhance, })

</td><td>

Adds contextual editing capability to a Uniform app. This hook is already integrated in <UniformComposition />, you won't need to use it directly, unless you have a custom setup.

</td></tr> <tr><td>

useUniformContextualEditingState({ global, })

</td><td>

Returns the state of contextual editing, when the app is open inside Canvas Editor. This hook can be used to improve the editing experience of your team. For example: You can use selectedComponentReference to control which element to show inside a carousel or an accordion.

</td></tr> <tr><td>

useUniformCurrentComponent()

</td><td>

Gets the data of the closest <UniformComponent /> ancestor.

</td></tr> <tr><td>

useUniformCurrentComposition()

</td><td>

Gets the data of the closest <UniformComposition /> ancestor.

</td></tr> </tbody></table>

Variables

<table><thead><tr><th>

Variable

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

componentStore

</td><td>

</td></tr> <tr><td>

componentStoreResolver

</td><td>

</td></tr> <tr><td>

getParameterAttributes

</td><td>

Returns the attributes needed to annotate a Uniform parameter for inline editing. Supports only text parameters at the moment.

</td></tr> <tr><td>

NOT_IMPLEMENTED_COMPONENT

</td><td>

Can be used to override default component Not Implemented fallback

</td></tr> <tr><td>

UniformCompositionContext

</td><td>

</td></tr> <tr><td>

UniformRichText

</td><td>

Adds rendering support for Uniform Rich Text parameters

</td></tr> </tbody></table>

Type Aliases

<table><thead><tr><th>

Type Alias

</th><th>

Description

</th></tr></thead> <tbody><tr><td>

ComponentProps

</td><td>

Props passed to a Canvas component implementation. TProps is the Canvas component's parameters object after all enhancers have been applied.

</td></tr> <tr><td>

ComponentStore

</td><td>

</td></tr> <tr><td>

CustomSlotChildRenderFunc

</td><td>

</td></tr> <tr><td>

RenderComponentResolver

</td><td>

Function that maps a Canvas component instance to its React component to render it. The resolver would commonly inspect the type and possibly variant of the component to decide.

</td></tr> <tr><td>

RenderRichTextComponentResolver

</td><td>

Function that maps a Rich Text node instance to its React component to render it. The resolver would commonly inspect the type of the component to decide.

</td></tr> <tr><td>

RichTextComponentProps

</td><td>

</td></tr> <tr><td>

RichTextRendererComponent

</td><td>

</td></tr> <tr><td>

SystemRenderConfig

</td><td>

Configures rendering of system components (tests, pz)

</td></tr> <tr><td>

SystemRenderFunction

</td><td>

Function that renders Canvas system internals

</td></tr> <tr><td>

UniformComponentContextValue

</td><td>

</td></tr> <tr><td>

UniformComponentProps

</td><td>

</td></tr> <tr><td>

UniformCompositionProps

</td><td>

</td></tr> <tr><td>

UniformPlaygroundDecorator

</td><td>

</td></tr> <tr><td>

UniformPlaygroundProps

</td><td>

</td></tr> <tr><td>

UniformRichTextNodeProps

</td><td>

</td></tr> <tr><td>

UniformRichTextProps

</td><td>

</td></tr> <tr><td>

UniformSlotProps

</td><td>

</td></tr> <tr><td>

UniformSlotWrapperComponentProps

</td><td>

</td></tr> <tr><td>

UniformTextProps

</td><td>

</td></tr> <tr><td>

UseCompositionEventEffectOptions

</td><td>

</td></tr> <tr><td>

UseUniformContextualEditingProps

</td><td>

</td></tr> <tr><td>

UseUniformContextualEditingStateProps

</td><td>

</td></tr> <tr><td>

UseUniformContextualEditingStateReturnType

</td><td>

</td></tr> </tbody></table>