Skip to content

DecisionInput

Defines a decision input record.

Attributes

model

Type: string

The decision model identifier determines both:

  • the type of value produced by decision.
  • the decision model used to produce it, and the required input parameters
"model": "color-set/explicit"

All decision models named color-set/* produce a Decision<ColorSet> and expose the resolved ColorSet value, which contains a set of ColorValues, and - when declared - tokens and token references.

The specific color-set/anchored decision model determines how the color scale is generated. In this case, the model starts with an anchor color and applies a modifier to create a number of color steps in either/both directions: up and down.

See Decision Types for the full list of decision types, their resulting values and available models, and respective parameters.

name

Type: string

The decision name is mandatory.

"name": "Green Foreground"

The decision name can be used to create relationships between decisions.

"params": {
"start": { "$name": "Green Foreground" }
}

The same decision name can be declared more than once.

Records of the same name will be merged into a single decision, capable of producing different values, according to context.

Decisions that share the same name must respect the following rules:

  • they must all be of the same type (color-value/* in the example below)
  • the must all be scoped to different contexts
[
{
"model": "color-value/explicit",
"name": "Green Foreground",
"params": { "value": "#090E0B" }
},
{
"model": "color-value/explicit",
"name": "Green Foreground",
"contexts": ["Colour Scheme: Light Mode"],
"params": { "value": "#F6FDF8" }
}
]

uuid

Type: string

This field is optional.

When provided it must be unique across all records.

"uuid": "8c628648-f9e8-439a-aec2-b3b96ded3893"

It can be used to retrieve decision values and to create relationships between decisions.

By referencing the record’s uuid, instead of the decision name, you can link a decision to a specific record regardless of applicable context.

"params": {
"value": { "$uuid": "8c628648-f9e8-439a-aec2-b3b96ded3893" }
}

description

Type: string

This field is optional.

Provide a small description for the decision.

"decription": "Strongest shade of Green"

usage

Type: string

This field is optional.

These guidelines inform the intent of the decision, namely to what they should be applied.

"usage": {
"isFor": ["Icons", "Backgrounds"],
"notFor": ["Typography"]
}

contexts

Type: string[] | LookupContexts

This field is optional.

Contexts inform where, when or to whom a certain design decision is applicable.

The decision value will exist only when at least one of these contexts is present.

"contexts": ["Email", "Support"]

Alternatively, a list of required contexts can be provided via an object:

  • all: string[] - The decision will only be in effect when all these contexts are present.
"contexts": {
"all": ["Email", "Support"]
}
  • some?: string[] - When provided, at least one of these contexts must also be present.
"contexts": {
"all": ["Email", "Support"],
"some": ["Headers", "Footers"]
}

params

Type: object

The shape of the parameters of each each decision is driven by the decision model.

As an example, the color-set/anchored decision model requires as input:

  • a starting color (here provided as a reference to another decision)
  • a modifier object with SignedPercentage values for
    • h - Hue
    • s - Saturation
    • l - Lightness
  • a number that specifies the total number of steps of the set
"model": "color-set/anchored"
"params": {
"anchor": { "$name": "Green Foreground" },
"after": {
"steps": 5,
"modifier": {
"l": { "mode": "linear", "by": 5 }
}
}
}

In turn, the color-set/explicit decision model, requires only a single parameter: the explicit list of colors (or references) in the set.

"model": "color-set/explicit",
"params": {
"values": ["#312506", "#564109", "#7D5E0A", "#A57B0A"]
}

As another example, the color-value/explicit

The color value can be specified in a number of formats, according to the 🚧 schema.

"model": "color-value/explicit",
"params": {
"value": { "h": 144, "s": 0.22, "l": 0.05 }
}

As well as a decision reference.

"model": "color-value/explicit",
"params": {
"value": { "$name": "Green Foreground" }
}

See also