# Feature Flags

Feature flags are a convenient way to toggle features on/off for an application. You can override these feature flags, and add your own if contributing to the library. Below is a list of feature flags available for the Splunk Visualizations library. We’ve added ones for certain major features or updates so that you may ensure it fits in users’ workflow before introducing them into your application.

To toggle features on or off for your application you may update the default value to true or false respectively in `visualization-context`.

## Consuming directly from @splunk/visualizations

To access these flags, wrap any component with the `FeatureFlagContextProvider`

```js
import FeatureFlagContext from '@splunk/visualization-context/FeatureFlagContext';

<FeatureFlagContextProvider value={{ visualizations_enableTrellis: true }}>

    <SingleValue … /> <!-- This component has visualizations_enableTrellis enabled -->

</FeatureFlagContextProvider>
```

## Consuming from Unified Dashboard Framework (UDF)

To access these flags, you can use the `useFeatureFlags` hook in any child component of a `DashboardContextProvider`.

```js
import { useFeatureFlags } from '@splunk/dashboard-context';

const MyComponent = () => {
    const { visualizations_enableTrellis } = useFeatureFlags();
};
```

If leveraging these visualizations from within UDF you may follow their guidance on `featureFlags` as documented in Dashboard Context. UDF will automatically leverage visualization feature flags as defined below.

```markup
| Feature Flag                          | Default                | Description
| -----------------------------------   |----------------------- | ------------------------------------------------------------------------------------------------------------------
| visualizations_enableTrellis          | false                  | Supported visualizations can be rendered in trellis layout display mode if `splitByLayout: trellis` is configured.
| visualizations_useWebWorkersForDSL    | false                  | This offloads the DSL evaluation to a web-worker. Every visualization that uses `withDashboardViz` will send the options to a static method `AsyncDynamicOptionsEvaluator.evaluate` which returns a promise. When the DSL evaluation is complete the results are returned back to the viz via the promise.
| visualizations_enableEventsViewerTags | false                  | This enables viewing and editing tags in the Events visualization.
| visualizations_enableDownsampling     | false                  | This enables largest-triangle-three-buckets downsampling for eligible charts with series.
| visualizations_lazyLoadingDataFrame | true                   | Builds an internal data structure on demand.
| visualizations_bypassCloneDeepOptionScope | true                   | Stops cloning of data when evaluating DSL.
```
