input

Allow user input in a dashboard using common form components such as text, select, multiselect, combo and multicombo. Data can either be static or derived from a SQL query.

Dashboard components can depend on the value of an input within the dashboard by referring to self e.g. self.input.<input_name>.value. This allows you to pass the value of an input as an argument to a query (or any other dashboard element) to create dynamic dashboards!

Input blocks can be declared as named resources at the top level of a mod, or be declared as named blocks inside a dashboard or container, or be re-used inside a dashboard or container by using an input with base = <mod>.input.<input_resource_name>.

Example Usage


Argument Reference

ArgumentTypeOptional?Description
argsMapOptionalA map of arguments to pass to the query.
baseStringOptionalA reference to a named input resource that this input should source its definition from. title, sql, type, options and width can be overridden after sourcing via base.
databaseStringOptionalA database connection reference, connection string, or Pipes workspace to query. If not specified, the default database will be used.
optionBlockOptionaloption block to add static values to the input
placeholderStringOptionalPlaceholder text to display. If a placeholder is set for a combo, multicombo, select or multiselect, then dependent resources will not run until a selection is made. If no placeholder is set, the first item in the list will be selected by default.
paramBlockOptionalA param block that defines the parameters that can be passed in to the query. param blocks may only be specified for inputs that specify the sql argument.
queryQuery ReferenceOptionalA reference to a query resource that defines the query to run. An input may either specify the query argument or the sql argument, but not both.
--search-pathStringOptionalSet a comma-separated list of connections to use as a custom search path for the query
--search-path-prefixStringOptionalSet a comma-separated list of connections to use as a prefix to the current search path for the query.
sqlStringOptionalAn SQL string to provide data for the input. An input may either specify the query argument or the sql argument, but not both.
titleStringOptionalA plain text title to display for this input.
typeStringOptionalThe type of the input. Can be text, combo, multicombo, select or multiselect.
widthNumberOptionalThe width as a number of grid units that this item should consume from its parent.

Input Types

TypeDescription
textEnter a single line of text
selectSelect a single item from a dropdown list
multiselectSelect one or more items from a dropdown list
comboSelect a single item from a dropdown list, or enter a new value
multicomboSelect one or more items from a dropdown list, or enter new values

Common Input Properties

option

Add static options to a select or multiselect input. The block name is the value. If a label is not specified, the value will be used as the label.

PropertyTypeDefaultDescription
labelStringIf not specified, the value will be used as the labelThe display label for this option

Data Structure

The data structure for an input will depend on the type.

select / multiselect / combo / multicombo

labelvaluetags
defaultvpc-05657e5bef9676266null
acme @ 10.84.0.0/16vpc-03656e5eef967f366{ "account_id": "123456789012" }

tags is an optional JSONB object of key/value pairs. Any tag values will be displayed in the list of available options, along with the selected option(s). This will allow you to identify resources across multi-account queries for example. When a user types to search in the input, the labels and tags will be searched.

More Examples

Single-select with tags


Single-select with fixed options

Single-select with fixed options, using labels

Multi-select with dynamic options


Select with dynamic options


Text input


Combo box


Multi-select combo box


Example dashboard using an input