--- title: collections.Dictionary linkTitle: dict description: Creates a map from a list of key and value pairs. categories: [functions] keywords: [] menu: docs: parent: functions function: aliases: [dict] returnType: mapany signatures: ['collections.Dictionary KEY VALUE [KEY VALUE]...'] relatedFunctions: - collections.Dictionary - collections.Group - collections.Index - collections.IsSet - collections.Where aliases: [/functions/dict] --- `dict` is especially useful for passing more than one value to a partial template. Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deeply nested structure, e.g.: ```go-text-template {{ $m := dict (slice "a" "b" "c") "value" }} ``` ## Example: using `dict` to pass multiple values to a `partial` The partial below creates an SVG and expects `fill`, `height` and `width` from the caller: ### Partial definition {{< code file="layouts/partials/svgs/external-links.svg" >}} {{< /code >}} ### Partial call The `fill`, `height` and `width` values can be stored in one object with `dict` and passed to the partial: {{< code file="layouts/_default/list.html" >}} {{ partial "svgs/external-links.svg" (dict "fill" "#01589B" "width" 10 "height" 20 ) }} {{< /code >}} [partials]: /templates/partials/