GoodData.UI API reference
  • GoodData.UI
  • Docs & APIs
  • Developers
  • GoodData.CN
  • GoodData.UI
  • Docs & APIs
  • Get GoodData.CN Community Edition
  • 10.26.0
  • Code samples
  • Gallery
  • GitHub

withCustomDecorator()

Home > @gooddata/sdk-ui-dashboard > IDashboardContentCustomizer > withCustomDecorator

IDashboardContentCustomizer.withCustomDecorator() method

This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Register a factory for dashboard content decorator providers.

Signature:

withCustomDecorator(providerFactory: (next: DashboardContentComponentProvider) => OptionalDashboardContentComponentProvider): IDashboardContentCustomizer;

Parameters

ParameterTypeDescription
providerFactory(next: DashboardContentComponentProvider) => OptionalDashboardContentComponentProviderfactory

Returns:

IDashboardContentCustomizer

Remarks

Decorators are a way to add customizations or embellishments on top of an existing component. Decorators are more complex to write because they need to work with the component they should decorate and add 'something' on top of that component.

This is best illustrated on an example:

Example

withCustomDecorator((next) => {
    return (dashboard) => {
        if (some_condition_to_prevent_decoration) {
            return undefined;
        }

        // Make sure you call this outside the component render function,
        // otherwise a new instance of the decorated component is created on each re-render.
        const Decorated = next(dashboard);

        function MyCustomDecorator(props) {
             return (
                 <div>
                     <p>My Custom Decoration</p>
                     <Decorated {...props} />
                 </div>
             )
        }

        return MyCustomDecorator;
    }
})

The above shows how to register a decorator that will use some condition to determine if dashboard content will be decorated.

Note: the factory function that you specify will be called immediately at the registration time. The provider that it returns will be called at render time.

  • IDashboardContentCustomizer.withCustomDecorator() method
  • Parameters
  • Remarks
  • Example
GoodData resources:
  • Documentation
Follow the community:
  • Community
Copyright © 2007–2025 GoodData Corporation. All Rights Reserved. Code licensed under a dual license - CC BY‑NC 4.0 for trial experience and GoodData.UI EULA for commercial use