# ValueOrFunction

Canonical page: https://www.adaptabletools.com/docs/reference/valueorfunction

A value that is either provided directly or computed from a context.

Shared Options primitive (Action Columns, Export, UI, Row Form, …). Prefer this
over declaring local `T | ((context) => T)` aliases in Options files.

When `TContext` is `void`, the function form takes no arguments.

Note: Prefer this for option values (`string`, `boolean`, arrays, plain objects).
Do not use when `T` itself may be a function — `typeof value === 'function'`
cannot distinguish a static function-valued option from the lazy form.

```ts title="TypeScript"
export type ValueOrFunction<T, TContext = void> = TContext extends void ? T | (() => T) : T | ((context: TContext) => T);
```
