Path input also File path, Folder picker

A field for a path on disk: a file to open, a folder, or where to save. In a std/ui window (with ray-elements/core/raylang.js) a Browse… button opens the system dialog; in a browser it is a plain text field. Everything else is ray-input.

Source on GitHub

A project's paths, in a std/ui window
Save settingsIn a browser these are plain text fields.
Sizes and states
Code

In a raylang app

Browse… shows only in a std/ui window with the native bridge. It opens the system's dialog for the mode, starting in the folder of the current path (save also suggests the current file name). The chosen path fills the field and fires input and change; the program gets it with the form like any other field.

<ray-path-input name="workspace" label="Workspace" mode="folder"></ray-path-input>
<ray-path-input name="export" label="Export to" mode="save" accept=".csv"></ray-path-input>
// The program's side: ui.events() through bridge.handle, then the form arrives as usual.
for e in ui.events() {
    if (bridge.handle(e)) {
        continue;
    }
    if (e.kind == "message" && e.tag.starts_with("settings:")) {
        save_settings(e.tag.substring(9, e.tag.len()))?;
    }
}

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-path-input> · RayPathInput

Browse… shows only with a native host that offers pick_path (see core/host.js); the dialog starts in the folder of the current path. The path can always be typed or pasted.

PropertyAttributeTypeDefaultDescription
modemode reflectsopen | folder | saveopenWhat the dialog chooses: an existing file, a folder, or a file to save (the current name is suggested).
acceptaccept reflectsstringFile types the dialog offers, as in <input type=file>: ".json,.toml", "image/*" (ignored for folders).
browseLabelbrowse-labelstringBrowse… (text path-input.browse)Text of the button.
dialogTitledialog-titlestringTitle of the system dialog (default: the label).
EventDescription
changeThe path changed: typed and committed, or chosen in the dialog.
ray-errorThe system dialog failed.
PartDescription
browseThe Browse… button.

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
path-input.browseBrowse…