Text box

Use text inputs to let dashboard users pass any number or string to the input that defines a token used throughout the dashboard.

The following options are available:

  • defaultValue
  • token

The following example uses tokens set by one text input to determine the number of results returned and another to set the color of various visualization properties.

A dashboard with three multiselect inputs.

Expand this window to copy/paste the dashboard definition into your own dashboard.

{
	"visualizations": {
		"viz_R8trLpwN": {
			"type": "splunk.table",
			"options": {
				"rowNumbers": true,
				"backgroundColor": "transparent",
				"headerBackgroundColor": "$hex$",
				"rowTextColorOdd": "#000000",
				"rowTextColorEven": "#294e70",
				"rowBackgroundColorOdd": "#ffffff",
				"headerTextColor": "#000000"
			},
			"dataSources": {
				"primary": "ds_BIdQZ95d"
			},
			"title": "Top $count$ Sourcetypes",
			"description": ""
		},
		"viz_mz81M1yZ": {
			"type": "splunk.singlevalue",
			"options": {
				"backgroundColor": "$hex$"
			},
			"dataSources": {
				"primary": "ds_iRJ9rn8s"
			},
			"title": "Average Count of Top $count$ Sourcetypes",
			"description": ""
		},
		"viz_aszgf6CD": {
			"type": "splunk.text",
			"options": {
				"content": "Text Input",
				"fontWeight": "bold",
				"textColor": "#000000"
			}
		},
		"viz_Xgrs9smW": {
			"type": "splunk.rectangle",
			"options": {
				"fill": "#708794",
				"stroke": "transparent",
				"rx": 4
			}
		},
		"viz_1oEXTiEw": {
			"type": "splunk.rectangle",
			"options": {
				"fill": "#708794",
				"stroke": "transparent",
				"rx": 4
			}
		},
		"viz_AC5HOg5v": {
			"type": "splunk.rectangle",
			"options": {
				"fill": "#ffffff",
				"stroke": "transparent",
				"rx": 4
			}
		},
		"viz_oXAXDETA": {
			"type": "splunk.rectangle",
			"options": {
				"fill": "#ffffff",
				"stroke": "transparent",
				"rx": 4
			}
		},
		"viz_MncaqNG1": {
			"type": "splunk.text",
			"options": {
				"content": "Number of sourcetypes shown  based on input count. \nColor of header bar changes based on input hex.",
				"fontSize": 14,
				"textColor": "#000000"
			}
		},
		"viz_nkQw0AQv": {
			"type": "splunk.text",
			"options": {
				"content": "Dynamic Table Based on Text Inputs",
				"textColor": "#FFFFFF",
				"fontSize": 14,
				"fontWeight": "bold"
			}
		},
		"viz_ARvOjH9G": {
			"type": "splunk.text",
			"options": {
				"content": "Text inputs allow users to choose titles, descriptions, and other forms of text entries. ",
				"fontSize": 14,
				"textColor": "#000000"
			}
		},
		"viz_fGDFzSpc": {
			"type": "splunk.text",
			"options": {
				"content": "Dynamic Single Value Based on Text Inputs",
				"textColor": "#FFFFFF",
				"fontSize": 14,
				"fontWeight": "bold"
			}
		},
		"viz_TrOPFEfj": {
			"type": "splunk.text",
			"options": {
				"content": "Average count changes from \"Input count\"\nBackground color changes from \"Input hex color\"",
				"fontSize": 14,
				"textColor": "#000000"
			}
		}
	},
	"dataSources": {
		"ds_BIdQZ95d": {
			"type": "ds.search",
			"options": {
				"query": "index=_internal | top limit=$count$ sourcetype | eval percent = round(percent,2)"
			},
			"name": "Search_1"
		},
		"ds_iRJ9rn8s": {
			"type": "ds.search",
			"options": {
				"queryParameters": {
					"earliest": "-24h@h",
					"latest": "now"
				},
				"query": "index=_internal | top limit=$count$ sourcetype | stats avg(count)"
			},
			"name": "Search_2"
		}
	},
	"inputs": {
		"input1": {
			"type": "input.text",
			"options": {
				"defaultValue": "5",
				"token": "count"
			},
			"title": "Input count:"
		},
		"input2": {
			"type": "input.text",
			"options": {
				"defaultValue": "#9964F1",
				"token": "hex"
			},
			"title": "Input hex color:"
		}
	},
	"layout": {
		"type": "absolute",
		"options": {
			"backgroundColor": "#ffffff",
			"width": 1500,
			"height": 700,
			"showTitleAndDescription": false,
			"display": "auto-scale"
		},
		"structure": [
			{
				"item": "viz_1oEXTiEw",
				"type": "block",
				"position": {
					"x": 770,
					"y": 160,
					"w": 700,
					"h": 470
				}
			},
			{
				"item": "viz_Xgrs9smW",
				"type": "block",
				"position": {
					"x": 30,
					"y": 160,
					"w": 710,
					"h": 470
				}
			},
			{
				"item": "viz_AC5HOg5v",
				"type": "block",
				"position": {
					"x": 790,
					"y": 210,
					"w": 660,
					"h": 380
				}
			},
			{
				"item": "viz_aszgf6CD",
				"type": "block",
				"position": {
					"x": 24,
					"y": 30,
					"w": 300,
					"h": 50
				}
			},
			{
				"item": "viz_oXAXDETA",
				"type": "block",
				"position": {
					"x": 50,
					"y": 210,
					"w": 670,
					"h": 380
				}
			},
			{
				"item": "viz_mz81M1yZ",
				"type": "block",
				"position": {
					"x": 920,
					"y": 300,
					"w": 390,
					"h": 250
				}
			},
			{
				"item": "viz_R8trLpwN",
				"type": "block",
				"position": {
					"x": 70,
					"y": 310,
					"w": 630,
					"h": 280
				}
			},
			{
				"item": "viz_MncaqNG1",
				"type": "block",
				"position": {
					"x": 70,
					"y": 220,
					"w": 360,
					"h": 70
				}
			},
			{
				"item": "viz_nkQw0AQv",
				"type": "block",
				"position": {
					"x": 50,
					"y": 170,
					"w": 530,
					"h": 80
				}
			},
			{
				"item": "viz_ARvOjH9G",
				"type": "block",
				"position": {
					"x": 30,
					"y": 80,
					"w": 570,
					"h": 50
				}
			},
			{
				"item": "viz_fGDFzSpc",
				"type": "block",
				"position": {
					"x": 790,
					"y": 160,
					"w": 530,
					"h": 80
				}
			},
			{
				"item": "viz_TrOPFEfj",
				"type": "block",
				"position": {
					"x": 800,
					"y": 220,
					"w": 360,
					"h": 70
				}
			}
		],
		"globalInputs": [
			"input1",
			"input2"
		]
	},
	"description": "Two text input examples shown changing SPL query, titles, coloring. ",
	"title": "Example — Text Input"
}