Text Fields
The --textfield option let you specify an area where the user can enter in some text before dismissing the dialog
It takes a parameter as text and uses that parameter as the textfield label both in the dialog UI and in reporting output
The results are sent to stdout when dialog exits in the following format:
<textfield text> : <user input>
or if using the --json option to enable json output:
{"<textfield text>" : "<user input>"}Examples
Section titled “Examples”If using the following dialog:
dialog --textfield "Textfield 1"
Will display the following dialog:

The user enters in a response:

which will result in the following output:
Textfield 1 : This is what the user entered
or when using --json
{"Textfield 1" : "This is what the user entered"}Additional Textfields
Section titled “Additional Textfields”Multiple textfields can be specified by adding additional --textfield options when calling dialog
e.g. dialog --textfield "Textfield 1" --textfield "Textfield 2"

You can specify as many textfialds as you need. Each textfield will output as a seperate field in the output.
You may need to adjust the --height of your dialog window if you are adding multiple textfirlds so they fit
Example:
dialog --textfield "First Name" --textfield "Surname" --textfield "Age" --textfield "Favourite Colour"
results in the following output:
First Name : JoeSurname : BloggsAge : 32Favourite Colour : Red--json
{"First Name" : "Joe","Surname" : "Bloggs","Age" : "32","Favourite Colour" : "Red"}Textfield Modifiers
Section titled “Textfield Modifiers”Modifiers are appended to the textfield label as comma-separated values:
--textfield "<label>,<modifier>,<modifier>=<value>"| Modifier | Description |
|---|---|
name=<text> | Use this value as the output key instead of the label |
required | Field must be filled before swiftDialog will exit |
secure | Hide input as it is typed (password field) |
passwordfill | Enable macOS password autofill on a secure field |
prompt="<text>" | Placeholder text shown inside the field (not returned in output) |
value="<text>" | Pre-populate the field with a default value (editable) |
regex=<pattern> | Require field content to match the regular expression |
regexerror=<text> | Custom error message shown when the regex is not satisfied |
editor | Multi-line text editor instead of a single-line field |
isdate | Replace the text field with a date picker. Output is formatted as a short date string. |
fileselect | Add a Select button that opens a file picker |
filetype=<types> | Restrict the file picker to the specified types (space-separated). Use file extensions (e.g. png jpg) or the type keywords folder, image, movie, video, audio. |
path=<path> | Set the initial directory for the file picker |
confirm | Add a confirmation field whose content must match the primary field |
name=<text> replaces the label as the key in output. Useful when you want a friendly label but a cleaner key name in the output.
Secure
Section titled “Secure”secure hides input as it is typed, and shows a lock icon. Content is still returned as plain text on stdout.
--textfield "Password,secure"
Password Fill
Section titled “Password Fill”passwordfill enables the macOS password autofill feature. Must be combined with secure.
--textfield "Password,secure,passwordfill"Required
Section titled “Required”required prevents swiftDialog from exiting until the field has a value. Required fields are marked with an * and highlighted when the user attempts to dismiss without filling them in.
--textfield "Full Name,required"
Prompt
Section titled “Prompt”prompt="<text>" shows placeholder text inside the field. The text disappears once the user starts typing and is not included in the output. Not supported on secure fields.
--textfield "Name,prompt="Enter your full name""
value="<text>" pre-populates the field with a default value that the user can edit.
--textfield "Default Value Test",value="Some default value"
Regex and Regex Error
Section titled “Regex and Regex Error”regex=<pattern> requires the field content to match the regular expression before swiftDialog will exit. regexerror=<text> sets the message shown when the pattern is not matched.
Unless the pattern explicitly allows it, a regex field cannot be empty.
--textfield "Product Code",prompt="Enter 5 digit code",regex="\d{5}",regexerror="Must be a five digit number"
Use --textfieldlivevalidation to show a green/red overlay on the field as the user types, giving immediate feedback on whether the regex is satisfied.
Editor
Section titled “Editor”editor presents a larger, multi-line text area instead of a single-line field.
--textfield "Notes,editor"
Date Picker
Section titled “Date Picker”isdate replaces the text field with a macOS date picker. The selected date is returned as a short date string (e.g. 3/24/2026).
--textfield "Start Date,isdate"File Select
Section titled “File Select”fileselect adds a Select button that opens a standard file picker. The chosen path is placed into the field and returned in the output.
--textfield "Config File,fileselect"Use filetype to restrict what can be selected. Values are space-separated and can be file extensions or type keywords:
| Value | Selects |
|---|---|
folder | Directories only |
image | Any image type |
movie / video | Any video type |
audio | Any audio type |
<extension> | Files matching that extension (e.g. png, pdf) |
--textfield "Select an image,fileselect,filetype=png jpg"--textfield "Select a folder,fileselect,filetype=folder"Use path=<path> to set the directory the file picker opens to:
--textfield "Log File,fileselect,path=/var/log"
Confirm
Section titled “Confirm”confirm adds a second field below the primary one. Both fields must contain the same value before swiftDialog will accept the input. Useful for password confirmation.
--textfield "Password,secure,required,confirm"Combining Modifiers
Section titled “Combining Modifiers”Modifiers can be combined freely (where compatible):
--textfield "<label>,secure,required,prompt="<prompt_text>""--textfield "<label>,required,regex="\d{5}",regexerror="Five digits required",prompt="00000""--textfield "<label>,fileselect,filetype="jpeg jpg png",path=/Users/Shared"JSON Format
Section titled “JSON Format”{ "textfield" : [ {"title" : "<label>", "required" : true, "secure" : true, "prompt" : "<prompt_text>"}, {"title" : "<label>", "editor" : true}, {"title" : "<label>", "fileselect" : true, "filetype" : "png jpg"}, {"title" : "<label>", "isdate" : true}, {"title" : "<label>", "regex" : "\\d{5}", "regexerror" : "Five digits required"}, {"title" : "<label>", "secure" : true, "confirm" : true} ]}Keyboard Behaviour
Section titled “Keyboard Behaviour”Pressing Return in any single-line text field triggers the Button 1 action, equivalent to clicking the default button. This does not apply to editor fields.